alpinocorpus-server is a web API/server for querying and reading Alpino treebanks. alpinocorpus-server uses the AlpinoCorpus Haskell module to process Alpino treebanks.
With the latest Haskell Platform and alpinocorpus module installed, run:
cabal configure cabal build cabal install
The API for alpinocorpus-server returns JSON, with two exceptions:
- Errors are reported using HTTP status codes.
- Syntactic trees are returned as XML data.
Retrieving a list of corpora
A list of corpora can be retrieved via the API root:
The corpora are returned as a list of objects, where each object has three fields: name, shortDesc, and longDesc.
Retrieving a list of corpus entries
A list of corpus entries can be retrieved in the following manner:
If you want to restrict the list of entries to those that match a given XPath query, use the query parameter:
If the query matches more than one node in an entry, the entry will be returned as many times as a matching node is found. This behavior can be changed using the unique parameter:
Retrieving an entry
An entry is retrieved by using an URL of the following form:
You can also ask the server to mark nodes that match a given query using a special attribute and value. Use the markerQuery, markerAttr, and markerValue parameters for this functionality.
- Consider: do we want to return each entry as often as it matches a query?
- Consider: do we want to provide SVG tree output?