You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2020/08/17 15:25:27 UTC
[uima-ruta] branch UIMA-6256-SPLIT-creates-invalid-annotations
created (now e92fc0a)
This is an automated email from the ASF dual-hosted git repository.
pkluegl pushed a change to branch UIMA-6256-SPLIT-creates-invalid-annotations
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git.
at e92fc0a UIMA-6256: started with test WIP
This branch includes the following new commits:
new e92fc0a UIMA-6256: started with test WIP
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[uima-ruta] 01/01: UIMA-6256: started with test WIP
Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pkluegl pushed a commit to branch UIMA-6256-SPLIT-creates-invalid-annotations
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git
commit e92fc0a78509d40481c653138672659148481380
Author: Peter Klügl <pe...@averbis.com>
AuthorDate: Mon Aug 17 17:23:32 2020 +0200
UIMA-6256: started with test WIP
---
.../org/apache/uima/ruta/action/SplitTest.java | 80 +++++++---------------
1 file changed, 26 insertions(+), 54 deletions(-)
diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/action/SplitTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/action/SplitTest.java
index 2320776..cfd4567 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/action/SplitTest.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/action/SplitTest.java
@@ -37,12 +37,13 @@ import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.ruta.engine.Ruta;
import org.apache.uima.ruta.engine.RutaTestUtils;
import org.apache.uima.ruta.engine.RutaTestUtils.TestFeature;
+import org.junit.Ignore;
import org.junit.Test;
public class SplitTest {
@Test
- public void testDefault() {
+ public void testDefault() throws Exception {
String document = "Some text. More text , with 1 , and more. even more text.";
String script = "PERIOD #{-> T1} PERIOD;";
script += " #{-> T1} PERIOD;";
@@ -59,13 +60,8 @@ public class SplitTest {
String fn = "number";
list.add(new TestFeature(fn, "", "uima.tcas.Annotation"));
- CAS cas = null;
- try {
- cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
- Ruta.apply(cas, script);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ CAS cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
+ Ruta.apply(cas, script);
Type t = null;
AnnotationIndex<AnnotationFS> ai = null;
@@ -95,14 +91,10 @@ public class SplitTest {
assertNotNull(featureValue);
assertEquals("1", ((AnnotationFS) featureValue).getCoveredText());
- if (cas != null) {
- cas.release();
- }
-
}
@Test
- public void testAddBegin() {
+ public void testAddBegin() throws Exception {
String document = "Some text. More text , with 1 , and more. even more text.";
String script = "PERIOD #{-> T1} PERIOD;";
script += " #{-> T1} PERIOD;";
@@ -119,13 +111,8 @@ public class SplitTest {
String fn = "number";
list.add(new TestFeature(fn, "", "uima.tcas.Annotation"));
- CAS cas = null;
- try {
- cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
- Ruta.apply(cas, script);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ CAS cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
+ Ruta.apply(cas, script);
Type t = null;
AnnotationIndex<AnnotationFS> ai = null;
@@ -155,14 +142,10 @@ public class SplitTest {
assertNotNull(featureValue);
assertEquals("1", ((AnnotationFS) featureValue).getCoveredText());
- if (cas != null) {
- cas.release();
- }
-
}
@Test
- public void testAddEnd() {
+ public void testAddEnd() throws Exception {
String document = "Some text. More text , with 1 , and more. even more text.";
String script = "PERIOD #{-> T1} PERIOD;";
script += " #{-> T1} PERIOD;";
@@ -179,13 +162,8 @@ public class SplitTest {
String fn = "number";
list.add(new TestFeature(fn, "", "uima.tcas.Annotation"));
- CAS cas = null;
- try {
- cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
- Ruta.apply(cas, script);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ CAS cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
+ Ruta.apply(cas, script);
Type t = null;
AnnotationIndex<AnnotationFS> ai = null;
@@ -215,10 +193,6 @@ public class SplitTest {
assertNotNull(featureValue);
assertEquals("1", ((AnnotationFS) featureValue).getCoveredText());
- if (cas != null) {
- cas.release();
- }
-
}
@Test
@@ -270,14 +244,10 @@ public class SplitTest {
assertNotNull(featureValue);
assertEquals("1", ((AnnotationFS) featureValue).getCoveredText());
- if (cas != null) {
- cas.release();
- }
-
}
@Test
- public void testBoundarySplit() {
+ public void testBoundarySplit() throws Exception {
String document = "Some text. More text , with 1 , and more. even more text.";
String script = "PERIOD #{-> T1} PERIOD;";
script += "#{-> T1} PERIOD;";
@@ -296,13 +266,8 @@ public class SplitTest {
String fn = "number";
list.add(new TestFeature(fn, "", "uima.tcas.Annotation"));
- CAS cas = null;
- try {
- cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
- Ruta.apply(cas, script);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ CAS cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
+ Ruta.apply(cas, script);
Type t = null;
AnnotationIndex<AnnotationFS> ai = null;
@@ -332,10 +297,6 @@ public class SplitTest {
assertNotNull(featureValue);
assertEquals("1", ((AnnotationFS) featureValue).getCoveredText());
- if (cas != null) {
- cas.release();
- }
-
}
@Test
@@ -366,8 +327,19 @@ public class SplitTest {
next = iterator.next();
assertEquals("even more text.", next.getCoveredText());
- cas.release();
-
}
+ @Test
+ @Ignore
+ public void testMultiSplit() throws Exception {
+ String document = "TODO";
+ String script = "Document{-> T1};";
+ script += "W.ct==\"no\"{-> T2};";
+ script += "T1{-> SPLIT(T2, true, false, false)};";
+ script += "T1{-> TRIM(COMMA)};";
+
+ CAS cas = RutaTestUtils.getCAS(document);
+ Ruta.apply(cas, script);
+// RutaTestUtils.assertAnnotationsEquals(cas, 1, 3, "c");
+ }
}