MORPH operator, more examples
diff --git a/examples/cosmas1.json b/examples/cosmas1.json
new file mode 100644
index 0000000..871fce1
--- /dev/null
+++ b/examples/cosmas1.json
@@ -0,0 +1,12 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Buch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas10.json b/examples/cosmas10.json
new file mode 100644
index 0000000..d958810
--- /dev/null
+++ b/examples/cosmas10.json
@@ -0,0 +1,41 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Institut",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "für",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "caseInsensitive" : true,
+ "key" : "deutsche",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Sprache",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas11.json b/examples/cosmas11.json
new file mode 100644
index 0000000..6cd164f
--- /dev/null
+++ b/examples/cosmas11.json
@@ -0,0 +1,40 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Institut",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "für",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "deutsch",
+ "layer" : "lemma",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Sprache",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas12.json b/examples/cosmas12.json
new file mode 100644
index 0000000..e6d8895
--- /dev/null
+++ b/examples/cosmas12.json
@@ -0,0 +1,43 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 0,
+ "max" : 2
+ } ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Institut",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "für",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Sprache",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas13.json b/examples/cosmas13.json
new file mode 100644
index 0000000..ea83cba
--- /dev/null
+++ b/examples/cosmas13.json
@@ -0,0 +1,56 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 0,
+ "max" : 1,
+ "exclude" : true
+ } ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Institut",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "für",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }, {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "deutsche",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Sprache",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas14.json b/examples/cosmas14.json
new file mode 100644
index 0000000..f7fd874
--- /dev/null
+++ b/examples/cosmas14.json
@@ -0,0 +1,40 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Institut",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "für",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "A",
+ "layer" : "pos",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Sprache",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas15.json b/examples/cosmas15.json
new file mode 100644
index 0000000..f5aabc0
--- /dev/null
+++ b/examples/cosmas15.json
@@ -0,0 +1,30 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:submatch",
+ "classRef" : [ 1 ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:position",
+ "frame" : "frame:startswith",
+ "operands" : [ {
+ "@type" : "korap:span",
+ "key" : "s"
+ }, {
+ "@type" : "korap:group",
+ "operation" : "operation:class",
+ "class" : 1,
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "wegen",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ } ]
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas16.json b/examples/cosmas16.json
new file mode 100644
index 0000000..61333fd
--- /dev/null
+++ b/examples/cosmas16.json
@@ -0,0 +1,31 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:submatch",
+ "classRef" : [ 1 ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:position",
+ "frame" : "frame:startswith",
+ "operands" : [ {
+ "@type" : "korap:span",
+ "key" : "s"
+ }, {
+ "@type" : "korap:group",
+ "operation" : "operation:class",
+ "class" : 1,
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "caseInsensitive" : true,
+ "key" : "wegen",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ } ]
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas17.json b/examples/cosmas17.json
new file mode 100644
index 0000000..32e073b
--- /dev/null
+++ b/examples/cosmas17.json
@@ -0,0 +1,21 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:position",
+ "frame" : "frame:startswith",
+ "operands" : [ {
+ "@type" : "korap:span",
+ "key" : "s"
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "caseInsensitive" : true,
+ "key" : "wegen",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas18.json b/examples/cosmas18.json
new file mode 100644
index 0000000..4a8aa85
--- /dev/null
+++ b/examples/cosmas18.json
@@ -0,0 +1,12 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:submatch",
+ "@spanRef" : [ 0, 1 ],
+ "operands" : [ {
+ "@type" : "korap:span",
+ "key" : "s"
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas19.json b/examples/cosmas19.json
new file mode 100644
index 0000000..b31d80b
--- /dev/null
+++ b/examples/cosmas19.json
@@ -0,0 +1,30 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:submatch",
+ "classRef" : [ 1 ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:position",
+ "frame" : "frame:startswith",
+ "operands" : [ {
+ "@type" : "korap:span",
+ "key" : "s"
+ }, {
+ "@type" : "korap:group",
+ "operation" : "operation:class",
+ "class" : 1,
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "V",
+ "layer" : "pos",
+ "match" : "match:eq"
+ }
+ } ]
+ } ]
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas2.json b/examples/cosmas2.json
new file mode 100644
index 0000000..fdcb2d3
--- /dev/null
+++ b/examples/cosmas2.json
@@ -0,0 +1,24 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "das",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Buch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas20.json b/examples/cosmas20.json
new file mode 100644
index 0000000..32887c7
--- /dev/null
+++ b/examples/cosmas20.json
@@ -0,0 +1,30 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:submatch",
+ "classRef" : [ 1 ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:position",
+ "frame" : "frame:endswith",
+ "operands" : [ {
+ "@type" : "korap:span",
+ "key" : "s"
+ }, {
+ "@type" : "korap:group",
+ "operation" : "operation:class",
+ "class" : 1,
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "V",
+ "layer" : "pos",
+ "match" : "match:eq"
+ }
+ } ]
+ } ]
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas3.json b/examples/cosmas3.json
new file mode 100644
index 0000000..2c77f42
--- /dev/null
+++ b/examples/cosmas3.json
@@ -0,0 +1,31 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 1,
+ "max" : 3
+ } ],
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "das",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Buch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas4.json b/examples/cosmas4.json
new file mode 100644
index 0000000..2040995
--- /dev/null
+++ b/examples/cosmas4.json
@@ -0,0 +1,40 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:and",
+ "operands" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 1,
+ "max" : 3
+ }, {
+ "@type" : "korap:distance",
+ "key" : "s",
+ "min" : 1,
+ "max" : 1
+ } ]
+ } ],
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "das",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Buch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas5.json b/examples/cosmas5.json
new file mode 100644
index 0000000..9b9222d
--- /dev/null
+++ b/examples/cosmas5.json
@@ -0,0 +1,59 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 0,
+ "max" : 5
+ } ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:and",
+ "operands" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 1,
+ "max" : 3
+ }, {
+ "@type" : "korap:distance",
+ "key" : "s",
+ "min" : 1,
+ "max" : 1
+ } ]
+ } ],
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "das",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Buch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Tisch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas6.json b/examples/cosmas6.json
new file mode 100644
index 0000000..488d3af
--- /dev/null
+++ b/examples/cosmas6.json
@@ -0,0 +1,59 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 0,
+ "max" : 5
+ } ],
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Tisch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:and",
+ "operands" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 1,
+ "max" : 3
+ }, {
+ "@type" : "korap:distance",
+ "key" : "s",
+ "min" : 1,
+ "max" : 1
+ } ]
+ } ],
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "das",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Buch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas7.json b/examples/cosmas7.json
new file mode 100644
index 0000000..aa430e8
--- /dev/null
+++ b/examples/cosmas7.json
@@ -0,0 +1,79 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 0,
+ "max" : 5
+ } ],
+ "operands" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "inOrder" : true,
+ "distances" : [ {
+ "@type" : "korap:group",
+ "operation" : "operation:and",
+ "operands" : [ {
+ "@type" : "korap:distance",
+ "key" : "w",
+ "min" : 1,
+ "max" : 3
+ }, {
+ "@type" : "korap:distance",
+ "key" : "s",
+ "min" : 1,
+ "max" : 1
+ } ]
+ } ],
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "das",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Buch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }, {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "auf",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "dem",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Tisch",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas8.json b/examples/cosmas8.json
new file mode 100644
index 0000000..a8f4a3f
--- /dev/null
+++ b/examples/cosmas8.json
@@ -0,0 +1,40 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Institut",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "für",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Deutsche",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Sprache",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/cosmas9.json b/examples/cosmas9.json
new file mode 100644
index 0000000..865226c
--- /dev/null
+++ b/examples/cosmas9.json
@@ -0,0 +1,40 @@
+{
+ "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "operation" : "operation:sequence",
+ "operands" : [ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Institut",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "für",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "deutsche",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ }, {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "Sprache",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ } ]
+ }
+}
\ No newline at end of file
diff --git a/examples/examples.txt b/examples/examples.txt
index aa5f23f..f9987d6 100644
--- a/examples/examples.txt
+++ b/examples/examples.txt
@@ -3,4 +3,25 @@
bsp3.json: "Der /+w1:3,s1 Mann"
bsp4.json: "(Der /+w1:3,s1 Mann) /+w5 geht"
bsp5.json: "(Der /+w1:3,s1 Mann) /-w5 geht"
-bsp6.json: "(Der /+w1:3,s1 Mann) /+w5 (geht weg)"
\ No newline at end of file
+bsp6.json: "(Der /+w1:3,s1 Mann) /+w5 (geht weg)"
+
+cosmas1.json: "Buch"
+cosmas2.json: "das Buch" // to demonstrate token sequences
+cosmas3.json: "das /+w1:3 Buch" // word-distance constraint
+cosmas4.json: "das /+w1:3,s1 Buch" // combined word-distance and sent-distance constraint
+cosmas5.json: "(das /+w1:3,s1 Buch) /+w5 Tisch" // complex distance constraint on sequences
+cosmas6.json: "(das /+w1:3,s1 Buch) /-w5 Tisch" // negative distance -> precedence
+cosmas7.json: "(das /+w1:3,s1 Buch) /+w5 (auf dem Tisch)"
+cosmas8.json: "Institut für Deutsche Sprache" // spelling variations: deutsche/Deutsche
+cosmas9.json: "Institut für deutsche Sprache"
+cosmas10.json: "Institut für $deutsche Sprache" // finds both
+cosmas11.json: "Institut für &deutsch Sprache" // finds both if base form (lemma) is annotated
+cosmas12.json: "Institut für /+w2 Sprache" // finds institutes for any language
+cosmas13.json: "Institut für %+w1 deutsche Sprach e" // finds institutes for anything
+cosmas14.json: "Institut für MORPH(A) Sprache" // finds institutes for any language
+cosmas15.json: "wegen #IN(L) <s>" // finds 'wegen' at beginning of sentence
+cosmas16.json: "$wegen #IN(L) <s>" // finds 'wegen' at beginning of sentence, also when capitalised
+cosmas17.json: "#BED($wegen , +sa)" // equivalent to above
+cosmas18.json: "#BEG(#ELEM(S))" // finds every sentence-initial word
+cosmas19.json: "MORPH(V) #IN(L) #ELEM(S)" // e.g. questions
+cosmas20.json: "MORPH(V) #IN(R) #ELEM(S)" // e.g. subordinate clauses
\ No newline at end of file
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
index 6aad6f2..a0d6cee 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
@@ -218,9 +218,9 @@
// negate field (see above)
if (negate) {
- fieldMap.put("match", "match:"+"ne");
+ fieldMap.put("match", "match:ne");
} else {
- fieldMap.put("match", "match:"+"eq");
+ fieldMap.put("match", "match:eq");
}
//Step II: decide where to put
putIntoSuperObject(token, 1);
@@ -235,13 +235,17 @@
fieldMap.put("@type", "korap:term");
// fieldMap.put("key", "morph:"+node.getChild(0).toString().replace(" ", "_"));
- fieldMap.put("key", node.getChild(0).toString().replace(" ", "_"));
+ String[] morphValues = node.getChild(0).toString().split(" ");
+ String pos = morphValues[0];
+
+ fieldMap.put("key", pos);
+ fieldMap.put("layer", "pos");
// make category-specific fieldMap entry
// negate field (see above)
if (negate) {
- fieldMap.put("match", "match:"+"ne");
+ fieldMap.put("match", "match:ne");
} else {
- fieldMap.put("match", "match:"+"eq");
+ fieldMap.put("match", "match:eq");
}
// List<String> morphValues = QueryUtils.parseMorph(node.getChild(0).toStringTree());
// System.err.println(morphValues);
@@ -768,7 +772,12 @@
"(Der /+w1:3,s1 Mann) /+w5 geht",
"(Der /+w1:3,s1 Mann) /-w5 geht",
"(Der /+w1:3,s1 Mann) /+w5 (geht weg)",
- "Tag der $offenen Tür"
+ "Tag der $offenen Tür",
+ "#BED($wegen , sa)",
+ "#BEG(#ELEM(S))",
+ "#BEG(<s>)",
+ "MORPH(V PRES)",
+ "Mond?"
};
CosmasTree.debug=true;
for (String q : queries) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
index ff7d432..21e0852 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
@@ -3,6 +3,8 @@
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
import de.ids_mannheim.korap.util.QueryException;
import org.slf4j.LoggerFactory;
@@ -23,6 +25,7 @@
public QuerySerializer() {
mapper = new ObjectMapper();
+ mapper.enable(SerializationFeature.INDENT_OUTPUT);
}
/**
@@ -45,12 +48,29 @@
* regex
* & field_group
*/
- "Der Mann",
- "Der /+w1:3 Mann",
- "Der /+w1:3,s1 Mann",
- "(Der /+w1:3,s1 Mann) /+w5 geht",
- "(Der /+w1:3,s1 Mann) /-w5 geht",
- "(Der /+w1:3,s1 Mann) /+w5 (geht weg)",
+ "Buch",
+ "das Buch",
+ "das /+w1:3 Buch",
+ "das /+w1:3,s1 Buch",
+ "(das /+w1:3,s1 Buch) /+w5 Tisch",
+ "(das /+w1:3,s1 Buch) /-w5 Tisch",
+ "(das /+w1:3,s1 Buch) /+w5 (auf dem Tisch)",
+
+
+ "Institut für Deutsche Sprache",
+ "Institut für deutsche Sprache",
+ "Institut für $deutsche Sprache",
+ "Institut für &deutsch Sprache",
+ "Institut für /+w2 Sprache",
+ "Institut für %+w1 deutsche Sprache",
+ "Institut für MORPH(A) Sprache",
+
+ "wegen #IN(L) <s>",
+ "$wegen #IN(L) <s>",
+ "#BED($wegen , +sa)",
+ "#BEG(#ELEM(S))",
+ "MORPH(V) #IN(L) #ELEM(S)",
+ "MORPH(V) #IN(R) #ELEM(S)",
};
} else {
@@ -61,7 +81,8 @@
i++;
try {
System.out.println(q);
- jg.run(q, "cosmas", System.getProperty("user.home") + "/bsp" + i + ".json");
+ String ql = "cosmas";
+ jg.run(q, ql, System.getProperty("user.home") + "/" + ql + i + ".json");
System.out.println();
} catch (NullPointerException npe) {
npe.printStackTrace();
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java
index cee10ef..5d9f0ba 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java
@@ -134,7 +134,6 @@
public static List<String> parseMorph(String stringTree) {
ArrayList<String> morph = new ArrayList<String>();
- System.err.println(stringTree);
return morph;
}
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index 999b328..63bf459 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -73,14 +73,29 @@
@Test
public void testCaseSensitivityFlag() throws QueryException {
- //TODO ignorieroperator $ http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/ignorierung.html
+ query="$deutscher";
+ String cs1 =
+ "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
+ assertEquals(cs1.replaceAll(" ", ""), map.replaceAll(" ", ""));
+
+ query="$deutscher Bundestag";
+ String cs2 =
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Bundestag, layer=orth, match=match:eq}}" +
+ "]}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
+ assertEquals(cs2.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@Test
public void testMORPH() throws QueryException {
query="#MORPH(V)";
String morph1 =
- "{@type=korap:token, wrap={@type=korap:term, key=V, match=match:eq}}";
+ "{@type=korap:token, wrap={@type=korap:term, key=V, layer=pos, match=match:eq}}";
ct = new CosmasTree(query);
map = ct.getRequestMap().get("query").toString();
assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", ""));
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index b51bc9a..d2ffe72 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -75,6 +75,26 @@
}
@Test
+ public void testCaseSensitivityFlag() throws QueryException {
+ String query="[orth=deutscher/i]";
+ String cs1 =
+ "{@type=korap:token, wrap={@type=korap:term, key=deutscher, layer=orth, match=match:eq, caseInsensitive=true}}";
+ ppt = new PoliqarpPlusTree(query);
+ map = ppt.getRequestMap().get("query").toString();
+ assertEquals(cs1.replaceAll(" ", ""), map.replaceAll(" ", ""));
+
+ query="[orth=deutscher/i][orth=Bundestag]";
+ String cs2 =
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=deutscher, layer=orth, match=match:eq, caseInsensitive=true}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Bundestag, layer=orth, match=match:eq}}" +
+ "]}";
+ ppt = new PoliqarpPlusTree(query);
+ map = ppt.getRequestMap().get("query").toString();
+ assertEquals(cs2.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ }
+
+ @Test
public void testElements() throws QueryException {
// <s>
String elem1 = "{@type=korap:span, key=s}";