PQ empty tokens as distance groups, Cosmas elem -> element
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index e16f8d8..0d7db7a 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -56,6 +56,16 @@
assertEquals(single3.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
+// @Test
+ public void testMORPH() throws QueryException {
+ query="#MORPH(V)";
+ String morph1 =
+ "{@type=korap:token, @value={@type=korap:term, @value=pos:v, relation==}}";
+ ppt = new CosmasTree(query);
+ map = ppt.getRequestMap().get("query").toString();
+ assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ }
+
@Test
public void testSequence() throws QueryException {
query="der Mann";
@@ -281,7 +291,7 @@
String opin1 =
"{@type=korap:group, relation=shrink, shrink=1, operands=[" +
"{@type=korap:group, relation=position, position=contains, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:group, class=1, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
"]}" +
@@ -295,7 +305,7 @@
String opin2 =
"{@type=korap:group, relation=shrink, shrink=1, operands=[" +
"{@type=korap:group, relation=position, position=startswith, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:group, class=1, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
"]}" +
@@ -309,7 +319,7 @@
String opin3 =
"{@type=korap:group, relation=shrink, shrink=1, operands=[" +
"{@type=korap:group, relation=position, position=startswith, @subtype=excl, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:group, class=1, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
"]}" +
@@ -323,7 +333,7 @@
String opin4 =
"{@type=korap:group, relation=shrink, shrink=1, operands=[" +
"{@type=korap:group, relation=position, position=ident, range=all, @subtype=excl, grouping=false, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:group, class=1, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
"]}" +
@@ -340,7 +350,7 @@
String opov1 =
"{@type=korap:group, relation=shrink, shrink=1, operands=[" +
"{@type=korap:group, relation=overlap, position=any, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:group, class=1, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
"]}" +
@@ -354,7 +364,7 @@
String opov2 =
"{@type=korap:group, relation=shrink, shrink=1, operands=[" +
"{@type=korap:group, relation=overlap, position=startswith, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:group, class=1, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
"]}" +
@@ -440,7 +450,7 @@
public void testELEM() throws QueryException {
// http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/elem.html
query="#ELEM(S)";
- String elem1 = "{@type=korap:elem, @value=s}";
+ String elem1 = "{@type=korap:element, @value=s}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -487,7 +497,7 @@
query = "#BED(der , sa)";
String bed1 =
"{@type=korap:group, relation=position, position=startswith, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}" +
"]}";
ppt = new CosmasTree(query);
@@ -497,7 +507,7 @@
query = "#BED(der Mann , +pe)";
String bed2 =
"{@type=korap:group, relation=position, position=endswith, operands=[" +
- "{@type=korap:elem, @value=p}," +
+ "{@type=korap:element, @value=p}," +
"{@type=korap:sequence, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
"{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
@@ -511,14 +521,14 @@
String bed3 =
"{@type=korap:group, relation=and, operands=[" +
"{@type=korap:group, relation=position, position=startswith, operands=[" +
- "{@type=korap:elem, @value=s}," +
+ "{@type=korap:element, @value=s}," +
"{@type=korap:sequence, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
"{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
"]}" +
"]}," +
"{@type=korap:group, relation=position, position=startswith, @subtype=excl, operands=[" +
- "{@type=korap:elem, @value=p}," +
+ "{@type=korap:element, @value=p}," +
"{@type=korap:sequence, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
"{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index 35753d6..5561d16 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -84,7 +84,7 @@
"{@type=korap:token, @value={@type=korap:term, @value=base:der, relation==}}," +
"{@type=korap:token, @value={@type=korap:term, @value=base:Mann, relation==}}" +
"]}";
- ppt = new PoliqarpPlusTree("[base=der][][base=Mann]");
+ ppt = new PoliqarpPlusTree("[base=der][][][base=Mann]");
map = ppt.getRequestMap().get("query").toString();
assertEquals(et2.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -101,31 +101,36 @@
map = ppt.getRequestMap().get("query").toString();
assertEquals(et3.replaceAll(" ", ""), map.replaceAll(" ", ""));
- // [base=der][]*[base=Mann]
- String et4 =
- "{@type=korap:group, relation=distance, @subtype=incl, constraint=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=0, max=INF}" +
- "], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=base:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=base:Mann, relation==}}" +
- "]}";
- ppt = new PoliqarpPlusTree("[base=der][]*[base=Mann]");
- map = ppt.getRequestMap().get("query").toString();
- assertEquals(et4.replaceAll(" ", ""), map.replaceAll(" ", ""));
// startswith(<s>, [][base=Mann]
- String et5 =
- "{@type=korap:group, relation=position, position=startswith, @subtype=incl, operands=[" +
- "{@type=korap:token, @value={@type=korap:elem, @value=s}," +
- "{@type=korap:sequence, offset=1, operands=[" +
+ String et4 =
+ "{@type=korap:group, relation=position, position=startswith, operands=[" +
+ "{@type=korap:element, @value=s}," +
+ "{@type=korap:sequence, offset-min=1, offset-max=1, operands=[" +
"{@type=korap:token, @value={@type=korap:term, @value=base:Mann, relation==}}" +
"]}" +
"]}";
- ppt = new PoliqarpPlusTree("startswith(<s>, [][base=Mann]");
+ ppt = new PoliqarpPlusTree("startswith(<s>, [][base=Mann])");
+ map = ppt.getRequestMap().get("query").toString();
+ assertEquals(et4.replaceAll(" ", ""), map.replaceAll(" ", ""));
+
+ String et5 =
+ "{@type=korap:group, relation=distance, @subtype=incl, constraint=[" +
+ "{@type=korap:distance, measure=w, direction=plus, min=1, max=1}" +
+ "], " +
+ "operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=base:der, relation==}}," +
+ "{@type=korap:group, relation=distance, @subtype=incl, constraint=[" +
+ "{@type=korap:distance, measure=w, direction=plus, min=2, max=2}" +
+ "], " +
+ "operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=base:Mann, relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=base:Frau, relation==}}" +
+ "]}" +
+ "]}";
+ ppt = new PoliqarpPlusTree("[base=der][][base=Mann][][][base=Frau]");
map = ppt.getRequestMap().get("query").toString();
assertEquals(et5.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
}