This is an automated email from the ASF dual-hosted git repository.

pkluegl pushed a commit to branch 
bugfix/161-Right-to-left-wildcard-matches-too-much
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git


The following commit(s) were added to 
refs/heads/bugfix/161-Right-to-left-wildcard-matches-too-much by this push:
     new 1c44f121 Issue #161: Right to left wildcard matches too much
1c44f121 is described below

commit 1c44f1213f7a79d71bcbc3765077fa37de971cf4
Author: kluegl <[email protected]>
AuthorDate: Fri Jan 26 16:23:53 2024 +0100

    Issue #161: Right to left wildcard matches too much
    
    - added test
---
 .../org/apache/uima/ruta/rule/WildCard2Test.java     | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git 
a/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java 
b/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java
index 4d81cb6c..a3ce7726 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/rule/WildCard2Test.java
@@ -344,4 +344,24 @@ public class WildCard2Test {
     RutaTestUtils.assertAnnotationsEquals(cas, 2, 1, "Is");
   }
 
+  @Test
+  public void testRightToLeft() throws Exception {
+    String document = "some Text with CAP";
+    String script = "";
+    script += "(ANY{-PARTOF(SW)-> T1} # CAP){->T2};\n";
+    script += "(ANY{-PARTOF(CW)-> T3} # CAP){->T4};\n";
+
+    CAS cas = RutaTestUtils.getCAS(document);
+    Ruta.apply(cas, script);
+
+    if (RutaTestUtils.DEBUG_MODE) {
+      RutaTestUtils.storeCas(cas, "testRightToLeft");
+    }
+
+    RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "Text");
+    RutaTestUtils.assertAnnotationsEquals(cas, 2, 1, "Text with CAP");
+    RutaTestUtils.assertAnnotationsEquals(cas, 3, 1, "with");
+    RutaTestUtils.assertAnnotationsEquals(cas, 4, 1, "with CAP");
+  }
+
 }

Reply via email to