commit | f82e748d40117271a7ec6943fad11914cfbc5f15 | [log] [tgz] |
---|---|---|
author | margaretha <margaretha@ids-mannheim.de> | Mon Feb 12 13:01:48 2018 +0100 |
committer | margaretha <margaretha@ids-mannheim.de> | Mon Feb 12 13:01:48 2018 +0100 |
tree | 2673a7ff76fcffbbe3218e8e516476cc6be26381 | |
parent | 1c4f01f5235de5ae5a3ff301169eaef663f8c095 [diff] |
Added java 1.7 executable path. Change-Id: I6264c202c3333b1978b54ac34959105659ba56c2
Koral is a translator tool for converting different corpus query languages to KoralQuery, a JSON-LD-based protocol for the common representation of linguistic queries. KoralQuery specifications are described extensively in Bingel (2015). This work has been carried out within the KorAP project.
Koral supports the following corpus query languages (QLs):
You can use the main class QuerySerializer to translate and serialize queries. Valid QL identifiers are cosmas2
, annis
, poliqarp
, poliqarpplus
, cql
and fcsql
.
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>
) 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 allows designing and implementating corpus query systems independent of any specific query languages. The systems only need to have Koral translate a query to a KoralQuery (see usage) and feed the translated query to their search engine. 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 its search engine.
Koral requires Java 1.7 particularly to compile Cosmas2 ANTLR grammars. In pom.xml, specify the javac location of your Java 1.7 in the <java1.7>
property. By default it set to /usr/local/java/jdk1.7.0_79
.
<properties> <java1.7>/usr/local/java/jdk1.7.0_79</java1.7> </properties>
Installation is straightforward (Maven3 required):
git clone https://github.com/korap/Koral [install-dir] cd [install-dir] mvn compile mvn test -Dhttps.protocols=TLSv1.2 mvn install
There is also a command line version. After installation, simply run
java -jar target/Koral-0.2.jar [query] [queryLanguage]
J. Bingel, "Instantiation and implementation of a corpus query lingua franca," M.S. thesis, University of Heidelberg, Heidelberg, 2015.
J. Bingel and N. Diewald, "KoralQuery – a General Corpus Query Protocol," in Proceedings of the Workshop on Innovative Corpus Query and Visualization Tools at NODALIDA 2015, Vilnius, 2015, pp. 1-5.
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.