MORPH operator, more examples
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}";