commit | 3d45e6c6ae17eaa7a435abab32b59329a363edb7 | [log] [tgz] |
---|---|---|
author | margaretha <margaretha@ids-mannheim.de> | Wed Jun 15 18:43:32 2016 +0200 |
committer | margaretha <margaretha@ids-mannheim.de> | Wed Jun 15 18:43:32 2016 +0200 |
tree | 04d08730df398146e503d2b3de1ce9a5dca90cfc | |
parent | 842af33fa88932c02f0975582593c1f211a2952a [diff] |
Implemented FCSQL Wildcard / empty token serialization. Change-Id: I831e20c6a88feec2eef821000bc7b08620dd5565
Koral is a library designed for the translation of different corpus query languages to KoralQuery, a JSON-LD-based protocol for the common representation of linguistic queries. This work has been carried out within the KorAP project (see below) and forms the major part of a Master thesis that is due to appear. The detailed specifications of KoralQuery will be covered in that thesis.
As of v0.1, the following corpus query languages (QLs) are supported:
You can use the main class QuerySerializer to translate and serialize queries for you. The usage example below illustrates this. Valid QL identifiers are cosmas2
, annis
, poliqarp
, poliqarpplus
and cql
.
import de.ids_mannheim.korap.query.serialize.QuerySerialzer; QuerySerializer qs = new QuerySerializer(); String query = "contains(<s>,[orth=zu][pos=ADJA])"; qs.setQuery(query, "poliqarpplus"); System.out.println(qs.toJSON());
This will print out the following JSON-LD string for the Koralized query. The query asks for a sentence element (<s>
) that is contained in a sequence of the surface form zu and a token with the part-of-speech tag ADJA. In the KoralQuery string, a containment relation is defined over two operands, an s span and a sequence of two tokens.
{ "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.2/context.jsonld", "query": { "@type": "koral:group", "operation": "operation:position", "frames": [ "frames:isAround" ], "operands": [ { "@type": "koral:span", "key": "s" }, { "@type": "koral:group", "operation": "operation:sequence", "operands": [ { "@type": "koral:token", "wrap": { "@type": "koral:term", "layer": "orth", "key": "zu", "match": "match:eq" } }, { "@type": "koral:token", "wrap": { "@type": "koral:term", "layer": "pos", "key": "ADJA", "match": "match:eq" } } ] } ] } }
Koral enables the design and implementation of corpus query systems independently of any specific query languages. All the system needs to do on the query processing side is have the query translated to KoralQuery (see usage) and feed the translated query to its search engine. In particular, several query languages can be supported without further adjustments to the search engine.
Koral and KoralQuery have been designed and developed within the KorAP Project, and are used in KorAP to translate queries to a common format before sending them to the backend.
Installation is straightforward (Maven3 required):
git clone https://github.com/korap/Koral [install-dir] cd [install-dir] mvn test mvn install
There is also a command line version. After installation, simply run
java -jar target/Koral-0.2.jar [query] [queryLanguage]
Java 7 (OpenJDK or Oracle JDK with [JCE] (http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html)) Git, At least Maven 3.2.1. Further dependencies are resolved by Maven.
Koral and KoralQuery were developed by Joachim Bingel, Nils Diewald, Michael Hanl and Eliza Margaretha at IDS Mannheim.
The ANTLR grammars for parsing ANNIS QL and COSMAS II QL were developed by Thomas Krause (HU Berlin) and Franck Bodmer (IDS Mannheim), respectively. Minor adaptations of those grammars were implemented by the Koral authors.
The authors wish to thank Piotr BaĆski, Franck Bodmer, Elena Frick and Carsten Schnober for their valuable input.
Koral is published under the BSD-2 License. See also the attached LICENSE.
The ANNIS grammar is licensed under the Apache License 2.0.