adapted empty token -> distances mapping (used to count one empty token too little)
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
index 57b5d98..38d26eb 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
@@ -278,8 +278,8 @@
String[] minmax = parseEmptySegments(emptySegments);
Integer min = Integer.parseInt(minmax[0]);
Integer max = Integer.parseInt(minmax[1]);
- sequence.put("offset-min", min);
- sequence.put("offset-max", max);
+ sequence.put("offset-min", min-1);
+ sequence.put("offset-max", max-1);
}
sequence.put("operands", sequenceOperands);
objectStack.push(sequence);
@@ -893,8 +893,8 @@
private String[] parseEmptySegments(ParseTree emptySegments) {
String[] minmax = new String[2];
- Integer min = 0;
- Integer max = 0;
+ Integer min = 1;
+ Integer max = 1;
ParseTree child;
for (int i=0; i<emptySegments.getChildCount()-1; i++) {
child = emptySegments.getChild(i);
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index b08a315..217d621 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -110,7 +110,7 @@
// [base=der][][base=Mann]
String et1 =
"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
- "{@type=korap:distance, key=w, min=1, max=1}" +
+ "{@type=korap:distance, key=w, min=2, max=2}" +
"], " +
"operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=match:eq}}," +
@@ -123,7 +123,7 @@
// [base=der][][][base=Mann]
String et2 =
"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
- "{@type=korap:distance, key=w, min=2, max=2}" +
+ "{@type=korap:distance, key=w, min=3, max=3}" +
"], " +
"operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=match:eq}}," +
@@ -136,7 +136,7 @@
// [base=der][][]?[base=Mann]
String et3 =
"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
- "{@type=korap:distance, key=w, min=1, max=2}" +
+ "{@type=korap:distance, key=w, min=2, max=3}" +
"], " +
"operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=match:eq}}," +
@@ -162,12 +162,12 @@
// [base=der][]{2,5}[base=Mann][]?[][base=Frau] nested distances=
String et5 =
"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
- "{@type=korap:distance, key=w, min=2, max=5}" +
+ "{@type=korap:distance, key=w, min=3, max=6}" +
"], " +
"operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=match:eq}}," +
"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
- "{@type=korap:distance, key=w, min=1, max=2}" +
+ "{@type=korap:distance, key=w, min=2, max=3}" +
"], " +
"operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=match:eq}}," +