Minor fixes and a documented bug in submatches (probably an index bug though)
diff --git a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
index 4d8c191..8bcc0eb 100644
--- a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
+++ b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
@@ -206,10 +206,30 @@
System.out.println("It took " + seconds + " seconds with classes");
+ t1 = 0;
+ t2 = 0;
+ // With submatch
+ json = getString(getClass().getResource("/queries/benchmark5-submatch.jsonld").getFile());
+
+ t1 = System.nanoTime();
+ for (int i = 1; i <= rounds; i++) {
+ kr = new KorapSearch(json).run(ki);
+ };
+ t2 = System.nanoTime();
+
+ seconds = (double)(t2-t1) / 1000000000.0;
+
+ System.out.println("It took " + seconds + " seconds with submatches");
+
+ /** HERE IS A BUG! */
+
+ System.err.println(kr.toJSON());
+
+
// System.err.println(kr.toJSON());
- System.err.println(kr.getMatch(3).getSnippetBrackets());
+ // System.err.println(kr.getMatch(3).getSnippetBrackets());
// 2000 rounds:
@@ -228,6 +248,13 @@
// It took 10.365989238 seconds without classes
// It took 13.833405885 seconds with classes
+ // It took 15.368675425 seconds without classes
+ // It took 18.347603186 seconds with classes
+ // It took 15.941057294 seconds with submatches
+
+ // It took 15.241253549 seconds without classes
+ // It took 17.30375624 seconds with classes
+ // It took 15.367171254 seconds with submatches
};
diff --git a/src/test/resources/queries/benchmark5-submatch.jsonld b/src/test/resources/queries/benchmark5-submatch.jsonld
new file mode 100644
index 0000000..a9cad71
--- /dev/null
+++ b/src/test/resources/queries/benchmark5-submatch.jsonld
@@ -0,0 +1,61 @@
+{
+ "@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",
+ "layer": "orth",
+ "key" : "der"
+ }
+ },
+ {
+ "@type" : "korap:group",
+ "operation" : "operation:submatch",
+ "classRef" : [2],
+ "operands" : [
+ {
+ "@type" : "korap:group",
+ "operation" : "operation:class",
+ "class" : 1,
+ "operands" : [
+ {
+ "@type": "korap:group",
+ "operation": "operation:sequence",
+ "operands" : [
+ {
+ "@type": "korap:token",
+ "wrap" : {
+ "@type": "korap:term",
+ "layer": "orth",
+ "key" : "Mann"
+ }
+ },
+ {
+ "@type" : "korap:group",
+ "operation" : "operation:class",
+ "class" : 2,
+ "operands" : [
+ {
+ "@type": "korap:token",
+ "wrap" : {
+ "@type": "korap:term",
+ "layer": "orth",
+ "key" : "und"
+ }
+ }
+ ]
+ }
+
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}