Cosmas wildcards
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
index feb6337..c81f0aa 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
@@ -185,6 +185,10 @@
// make category-specific fieldMap entry
String attr = nodeCat.equals("OPWF") ? "orth" : "lemma";
String value = node.getChild(0).toStringTree().replaceAll("\"", "");
+ Pattern p = Pattern.compile("[+*?]");
+ Matcher m = p.matcher(value);
+ if (m.find()) fieldMap.put("type", "type:wildcard");
+
if (value.startsWith("$")) {
value = value.substring(1);
fieldMap.put("caseInsensitive", true);
@@ -1064,7 +1068,9 @@
// "MORPH(V PRES IND)",
// "wegen #OV(F) <s>"
// "Sonne /s0 Mond",
- "Sonne /+w1:4 Mond /-w1:7 Sterne"
+ "Sonne /+w1:4 Mond /-w1:7 Sterne",
+ "Der:t",
+ "*mond"
};
CosmasTree.verbose=true;
for (String q : queries) {
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index f5f494a..980de39 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -45,6 +45,16 @@
}
@Test
+ public void testWildcardToken() throws QueryException {
+ query="*der";
+ String wc1 =
+ "{@type=korap:token, wrap={@type=korap:term, type=type:wildcard, key=*der, layer=orth, match=match:eq}}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
+ assertEquals(wc1.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ }
+
+ @Test
public void testCaseSensitivityFlag() throws QueryException {
query="$deutscher";
String cs1 =