Added sentence expansion for match info
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index 51308d1..6c80e4c 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -208,6 +208,9 @@
assertEquals("... Orte in [Norwegen]: Å i ...", kr.match(2).getSnippetBrackets());
assertEquals("WPD_AAA.00005", kr.match(2).getDocID());
+ /*
+ System.err.println(ki.getMatchInfo(kr.match(2).getID(), "tokens", "xip", "l", true, false).getSnippetHTML());
+ */
query = kq.seg("tt/l:Vokal").without("mate/m:number:sg").toQuery();
kr = ki.search(query, 0, (short) 5, true, (short) 2, false, (short) 5);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
index ffbf04e..b556c6f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -479,6 +479,33 @@
};
+ @Test
+ public void indexExample7SentenceExpansion () throws IOException {
+ KorapIndex ki = new KorapIndex();
+ ki.addDoc(createSimpleFieldDoc());
+ ki.commit();
+
+ KorapMatch km = ki.getMatchInfo("match-c1!d1-p3-4",
+ "tokens",
+ null,
+ null,
+ false,
+ false);
+
+ assertEquals("... [{f/m:vier:{f/y:four:{it/is:4:{x/o:viertens:a}}}}] ...",
+ km.getSnippetBrackets());
+
+ km = ki.getMatchInfo("match-c1!d1-p3-4",
+ "tokens",
+ null,
+ null,
+ false,
+ false,
+ true);
+
+ assertEquals("... [{f/m:drei:{f/y:three:{it/is:3:{x/o:drittens:c}}}}{f/m:vier:{f/y:four:{it/is:4:{x/o:viertens:a}}}}{f/m:fuenf:{f/y:five:{it/is:5:{x/o:fünftens:b}}}}] ...",
+ km.getSnippetBrackets());
+ };
private FieldDocument createSimpleFieldDoc(){
FieldDocument fd = new FieldDocument();
@@ -488,7 +515,7 @@
"abcabcabac",
"[(0-1)s:a|i:a|f/m:eins|f/y:one|x/o:erstens|it/is:1|>:x/rel:a$<i>4|_0#0-1|-:t$<i>10]" +
"[(1-2)s:b|i:b|f/m:zwei|f/y:two|x/o:zweitens|it/is:2|_1#1-2]" +
- "[(2-3)s:c|i:c|f/m:drei|f/y:three|x/o:drittens|it/is:3|_2#2-3]" +
+ "[(2-3)s:c|i:c|f/m:drei|f/y:three|x/o:drittens|it/is:3|_2#2-3|<>:s#2-5$<i>5]" +
"[(3-4)s:a|i:a|f/m:vier|f/y:four|x/o:viertens|it/is:4|<:x/rel:b$<i>1|_3#3-4]" +
"[(4-5)s:b|i:b|f/m:fuenf|f/y:five|x/o:fünftens|it/is:5|_4#4-5]" +
"[(5-6)s:c|i:c|f/m:sechs|f/y:six|x/o:sechstens|it/is:6|_5#5-6]" +
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
index 979dacd..780a397 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
@@ -200,11 +200,19 @@
public void queryJSONcosmas4 () {
SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/cosmas4.json").getFile());
- // "das /+w1:3,s1 Buch"
+ // "das /+w1:3,s1:1 Buch"
assertEquals(sqwi.toQuery().toString(), "spanMultipleDistance(tokens:s:das, tokens:s:Buch, [(w[1:3], ordered, notExcluded), (s[1:1], ordered, notExcluded)])");
};
@Test
+ public void queryJSONcosmas4b () {
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/cosmas4b.json").getFile());
+
+ // "das /+w1:3,s1 Buch"
+ assertEquals(sqwi.toQuery().toString(), "spanMultipleDistance(tokens:s:das, tokens:s:Buch, [(w[1:3], ordered, notExcluded), (s[0:1], ordered, notExcluded)])");
+ };
+
+ @Test
public void queryJSONcosmas10 () {
SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/cosmas10.json").getFile());
diff --git a/src/test/resources/queries/readme.txt b/src/test/resources/queries/readme.txt
index 2aa2f2e..c5b3d63 100644
--- a/src/test/resources/queries/readme.txt
+++ b/src/test/resources/queries/readme.txt
@@ -20,7 +20,7 @@
// Based on KorAP-querySerialization/examples/
cosmas3: "das /+w1:3 Buch" # word-distance constraint
-cosmas4: "das /+w1:3,s1 Buch" # combined word-distance and sent-distance constraint
+cosmas4: "das /+w1:3,s1:1 Buch" # combined word-distance and sent-distance constraint
cosmas10: "Institut für $deutsche Sprache" # finds both
cosmas16: "$wegen #IN(L) <s>" # finds 'wegen' at beginning of sentence, also when capitalised
cosmas17: "#BED($wegen , +sa)" # equivalent to above