You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/09/22 14:54:31 UTC
svn commit: r1174101 - in
/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine: ./ desc/
src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/
src/test/java/org/apache/uima/ src/test/java/org/apache/uima/textmarker/
src/test/resour...
Author: joern
Date: Thu Sep 22 12:54:30 2011
New Revision: 1174101
URL: http://svn.apache.org/viewvc?rev=1174101&view=rev
Log:
UIMA-2207 New implementation of the rule inference.
Added:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest1.java (with props)
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest2.java (with props)
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/RuleInferenceTest.java (with props)
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java (with props)
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.tm
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.txt (with props)
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.tm
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.txt (with props)
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.tm
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.txt (with props)
Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/.classpath
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/desc/InternalTypeSystem.xml
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/.classpath
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/.classpath?rev=1174101&r1=1174100&r2=1174101&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/.classpath (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/.classpath Thu Sep 22 12:54:30 2011
@@ -7,5 +7,7 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="desc"/>
+ <classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/desc/InternalTypeSystem.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/desc/InternalTypeSystem.xml?rev=1174101&r1=1174100&r2=1174101&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/desc/InternalTypeSystem.xml (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/desc/InternalTypeSystem.xml Thu Sep 22 12:54:30 2011
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
<name>InternalTypeSystem</name>
<description/>
@@ -140,6 +122,13 @@
<rangeTypeName>uima.cas.FSArray</rangeTypeName>
<elementType>org.apache.uima.textmarker.type.DebugEvaluatedCondition</elementType>
</featureDescription>
+ <featureDescription>
+ <name>elements</name>
+ <description/>
+ <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+ <elementType>org.apache.uima.textmarker.type.DebugRuleElementMatches</elementType>
+ <multipleReferencesAllowed>false</multipleReferencesAllowed>
+ </featureDescription>
</features>
</typeDescription>
<typeDescription>
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest1.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest1.java?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest1.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest1.java Thu Sep 22 12:54:30 2011
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.junit.Test;
+
+public class QuantifierTest1 {
+ @Test
+ public void test() {
+ String name = this.getClass().getSimpleName();
+ String namespace = this.getClass().getPackage().getName().replaceAll("\\.", "/");
+ CAS cas = null;
+ try {
+ cas = TextMarkerTestUtils.process(namespace + "/" + name + ".tm", namespace + "/" + name
+ + ".txt", 50);
+ } catch (Exception e) {
+ e.printStackTrace();
+ assert (false);
+ }
+ Type t = null;
+ AnnotationIndex<AnnotationFS> ai = null;
+ FSIterator<AnnotationFS> iterator = null;
+
+ t = TextMarkerTestUtils.getTestType(cas, 1);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 2);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 3);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A B B", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 4);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 5);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(2, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A B B", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 6);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(2, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A B", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 7);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(1, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B B", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 8);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(1, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B B", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 9);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(2, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A B B", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 10);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 11);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B", iterator.next().getCoveredText());
+ assertEquals("A B B", iterator.next().getCoveredText());
+ assertEquals("A", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 12);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(2, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B C", iterator.next().getCoveredText());
+ assertEquals("A C", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 13);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(2, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B C", iterator.next().getCoveredText());
+ assertEquals("A C", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 14);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B C", iterator.next().getCoveredText());
+ assertEquals("A B B C", iterator.next().getCoveredText());
+ assertEquals("A C", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 15);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B C", iterator.next().getCoveredText());
+ assertEquals("A B B C", iterator.next().getCoveredText());
+ assertEquals("A C", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 16);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(2, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B C", iterator.next().getCoveredText());
+ assertEquals("A B B C", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 17);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(2, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A B C", iterator.next().getCoveredText());
+ assertEquals("A B B C", iterator.next().getCoveredText());
+
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest1.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest2.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest2.java?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest2.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest2.java Thu Sep 22 12:54:30 2011
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.junit.Test;
+
+public class QuantifierTest2 {
+ @Test
+ public void test() {
+ String name = this.getClass().getSimpleName();
+ String namespace = this.getClass().getPackage().getName().replaceAll("\\.", "/");
+ CAS cas = null;
+ try {
+ cas = TextMarkerTestUtils.process(namespace + "/" + name + ".tm", namespace + "/" + name
+ + ".txt", 50);
+ } catch (Exception e) {
+ e.printStackTrace();
+ assert (false);
+ }
+ Type t = null;
+ AnnotationIndex<AnnotationFS> ai = null;
+ FSIterator<AnnotationFS> iterator = null;
+
+ t = TextMarkerTestUtils.getTestType(cas, 1);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A3 A4", iterator.next().getCoveredText());
+ assertEquals("A4 A5", iterator.next().getCoveredText());
+ assertEquals("A6 A7", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 2);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(1, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A1 B B A2", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 3);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(0, ai.size());
+
+ t = TextMarkerTestUtils.getTestType(cas, 4);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(4, ai.size());
+ iterator = ai.iterator();
+ assertEquals("A1 B B A2", iterator.next().getCoveredText());
+ assertEquals("A3 A4", iterator.next().getCoveredText());
+ assertEquals("A4 A5", iterator.next().getCoveredText());
+ assertEquals("A6 A7", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 5);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(0, ai.size());
+
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/QuantifierTest2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/RuleInferenceTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/RuleInferenceTest.java?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/RuleInferenceTest.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/RuleInferenceTest.java Thu Sep 22 12:54:30 2011
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.junit.Test;
+
+public class RuleInferenceTest {
+
+ @Test
+ public void test() {
+ String name = this.getClass().getSimpleName();
+ String namespace = this.getClass().getPackage().getName().replaceAll("\\.", "/");
+ CAS cas = null;
+ try {
+ cas = TextMarkerTestUtils.process(namespace + "/" + name + ".tm", namespace + "/" + name
+ + ".txt", 50);
+ } catch (Exception e) {
+ e.printStackTrace();
+ assert (false);
+ }
+ Type t = null;
+ AnnotationIndex<AnnotationFS> ai = null;
+ FSIterator<AnnotationFS> iterator = null;
+
+ t = TextMarkerTestUtils.getTestType(cas, 1);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(4, ai.size());
+ iterator = ai.iterator();
+ assertEquals("Peter", iterator.next().getCoveredText());
+ assertEquals("Jochen", iterator.next().getCoveredText());
+ assertEquals("Flo", iterator.next().getCoveredText());
+ assertEquals("Georg", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 2);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(1, ai.size());
+ assertEquals("und", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 3);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(0, ai.size());
+
+ t = TextMarkerTestUtils.getTestType(cas, 4);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(5, ai.size());
+ assertEquals("Peter", iterator.next().getCoveredText());
+ assertEquals("Jochen", iterator.next().getCoveredText());
+ assertEquals("Flo und Georg", iterator.next().getCoveredText());
+ assertEquals("und Georg", iterator.next().getCoveredText());
+ assertEquals("Georg", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 5);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(2, ai.size());
+ assertEquals(",", iterator.next().getCoveredText());
+ assertEquals(",", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 6);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(2, ai.size());
+ assertEquals("Peter, Jochen,", iterator.next().getCoveredText());
+ assertEquals("Jochen,", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 7);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(5, ai.size());
+ assertEquals("Peter", iterator.next().getCoveredText());
+ assertEquals("Jochen", iterator.next().getCoveredText());
+ assertEquals("Flo", iterator.next().getCoveredText());
+ assertEquals("und", iterator.next().getCoveredText());
+ assertEquals("Georg", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 8);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(5, ai.size());
+ assertEquals("Peter", iterator.next().getCoveredText());
+ assertEquals("Jochen", iterator.next().getCoveredText());
+ assertEquals("Flo und Georg", iterator.next().getCoveredText());
+ assertEquals("und Georg", iterator.next().getCoveredText());
+ assertEquals("Georg", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 9);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(2, ai.size());
+ assertEquals("Peter, Jochen, Flo", iterator.next().getCoveredText());
+ assertEquals("Jochen, Flo", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 10);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(3, ai.size());
+ assertEquals("Peter, Jochen, Flo und", iterator.next().getCoveredText());
+ assertEquals("Jochen, Flo und", iterator.next().getCoveredText());
+ assertEquals("Flo und", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 11);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(3, ai.size());
+ assertEquals("Peter, Jochen, Flo und Georg.", iterator.next().getCoveredText());
+ assertEquals("Jochen, Flo und Georg.", iterator.next().getCoveredText());
+ assertEquals("Flo und Georg.", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 12);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(6, ai.size());
+ assertEquals(",", iterator.next().getCoveredText());
+ assertEquals(",", iterator.next().getCoveredText());
+ assertEquals(",", iterator.next().getCoveredText());
+ assertEquals("und", iterator.next().getCoveredText());
+ assertEquals("und", iterator.next().getCoveredText());
+ assertEquals("und", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 13);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(6, ai.size());
+ assertEquals("Peter,", iterator.next().getCoveredText());
+ assertEquals("Jochen,", iterator.next().getCoveredText());
+ assertEquals("Jochen,", iterator.next().getCoveredText());
+ assertEquals("Flo und", iterator.next().getCoveredText());
+ assertEquals("Flo und", iterator.next().getCoveredText());
+ assertEquals("Flo und", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 14);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(3, ai.size());
+ assertEquals("Peter, Jochen, Flo und", iterator.next().getCoveredText());
+ assertEquals("Jochen, Flo und", iterator.next().getCoveredText());
+ assertEquals("Flo und", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 15);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(1, ai.size());
+ assertEquals("Peter, Jochen", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 16);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(1, ai.size());
+ assertEquals("Georg.", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 17);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(1, ai.size());
+ assertEquals("Flo und Georg.", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 18);
+ ai = cas.getAnnotationIndex(t);
+ assertEquals(3, ai.size());
+ iterator = ai.iterator();
+ assertEquals("Peter,", iterator.next().getCoveredText());
+ assertEquals("Jochen,", iterator.next().getCoveredText());
+ assertEquals("Georg.", iterator.next().getCoveredText());
+
+ if (cas != null) {
+ cas.release();
+ }
+
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/RuleInferenceTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java Thu Sep 22 12:54:30 2011
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.resource.ResourceConfigurationException;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.textmarker.engine.TextMarkerEngine;
+import org.apache.uima.util.CasCreationUtils;
+import org.apache.uima.util.FileUtils;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+
+public class TextMarkerTestUtils {
+
+ private static final String TYPE = "org.apache.uima.T";
+
+ public static CAS process(String ruleFileName, String textFileName, int amount)
+ throws URISyntaxException, IOException, InvalidXMLException,
+ ResourceInitializationException, AnalysisEngineProcessException,
+ ResourceConfigurationException {
+ URL resource = TextMarkerTestUtils.class.getClassLoader().getResource(ruleFileName);
+ File ruleFile = new File(resource.toURI());
+ resource = TextMarkerTestUtils.class.getClassLoader().getResource(textFileName);
+ File textFile = new File(resource.toURI());
+ File aedFile = new File("desc/BasicEngine.xml");
+ XMLInputSource in = new XMLInputSource(aedFile);
+ ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
+ AnalysisEngineDescription aed = (AnalysisEngineDescription) specifier;
+
+ TypeSystemDescription basicTypeSystem = aed.getAnalysisEngineMetaData().getTypeSystem();
+ for (int i = 1; i <= amount; i++) {
+ basicTypeSystem.addType(TYPE + i, "Type for Testing", "uima.tcas.Annotation");
+ }
+
+ Collection<TypeSystemDescription> tsds = new ArrayList<TypeSystemDescription>();
+ tsds.add(basicTypeSystem);
+ TypeSystemDescription mergeTypeSystems = CasCreationUtils.mergeTypeSystems(tsds);
+ aed.getAnalysisEngineMetaData().setTypeSystem(mergeTypeSystems);
+
+ AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
+ ae.setConfigParameterValue(TextMarkerEngine.SCRIPT_PATHS, new String[] { ruleFile
+ .getParentFile().getPath() });
+ String name = ruleFile.getName();
+ if (name.endsWith(".tm")) {
+ name = name.substring(0, name.length() - 3);
+ }
+ ae.setConfigParameterValue(TextMarkerEngine.MAIN_SCRIPT, name);
+
+ ae.reconfigure();
+ CAS cas = ae.newCAS();
+ cas.setDocumentText(FileUtils.file2String(textFile, "UTF-8"));
+ ae.process(cas);
+ return cas;
+ }
+
+ public static Type getTestType(CAS cas, int i) {
+ if (cas == null)
+ return null;
+ return cas.getTypeSystem().getType(TYPE + i);
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.tm?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.tm (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.tm Thu Sep 22 12:54:30 2011
@@ -0,0 +1,32 @@
+PACKAGE org.apache.uima;
+
+
+DECLARE T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17;
+DECLARE T20, T21, T22;
+
+
+W {REGEXP("A") -> MARK(T20)};
+W {REGEXP("B") -> MARK(T21)};
+W {REGEXP("C") -> MARK(T22)};
+
+
+T20{-> MARK(T1, 1, 2)} T21?;
+T20{-> MARK(T2, 1, 2)} T21??;
+T20{-> MARK(T3, 1, 2)} T21*;
+T20{-> MARK(T4, 1, 2)} T21*?;
+T20{-> MARK(T5, 1, 2)} T21+;
+T20{-> MARK(T6, 1, 2)} T21+?;
+T20{-> MARK(T7, 1, 2)} T21[2];
+T20{-> MARK(T8, 1, 2)} T21[2,];
+T20{-> MARK(T9, 1, 2)} T21[1,2];
+T20{-> MARK(T10, 1, 2)} T21[0,1];
+T20{-> MARK(T11, 1, 2)} T21[0,];
+
+T20{-> MARK(T12, 1, 2, 3)} T21? T22;
+T20{-> MARK(T13, 1, 2, 3)} T21?? T22;
+T20{-> MARK(T14, 1, 2, 3)} T21* T22;
+T20{-> MARK(T15, 1, 2, 3)} T21*? T22;
+T20{-> MARK(T16, 1, 2, 3)} T21+ T22;
+T20{-> MARK(T17, 1, 2, 3)} T21+? T22;
+
+
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.txt?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.txt (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.txt Thu Sep 22 12:54:30 2011
@@ -0,0 +1,5 @@
+A B C
+
+A B B C
+
+A C
\ No newline at end of file
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest1.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.tm?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.tm (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.tm Thu Sep 22 12:54:30 2011
@@ -0,0 +1,20 @@
+PACKAGE org.apache.uima;
+
+DECLARE A, B, C;
+
+DECLARE T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17;
+DECLARE T20, T21, T22;
+
+W {REGEXP("A") -> MARK(T20,1,2)} NUM;
+W {REGEXP("B") -> MARK(T21)};
+W {REGEXP("C") -> MARK(T22)};
+
+
+T20+?{->MARK(T1, 1, 2)} T20;
+
+Document{-> FILTERTYPE(T21)};
+T20+?{-PARTOF(T1) -> MARK(T2, 1, 2)} T20;
+T20+{-PARTOF(T1) -> MARK(T3, 1, 2)} T20;
+
+T20+?{ -> MARK(T4, 1, 2)} T20;
+T20*{ -> MARK(T5, 1, 2)} T20;
\ No newline at end of file
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.txt?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.txt (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.txt Thu Sep 22 12:54:30 2011
@@ -0,0 +1,3 @@
+A1 B B A2 C
+A3 A4 A5 C
+A6 A7
\ No newline at end of file
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/QuantifierTest2.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.tm?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.tm (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.tm Thu Sep 22 12:54:30 2011
@@ -0,0 +1,34 @@
+PACKAGE org.apache.uima;
+
+DECLARE T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20;
+
+CW{-> MARK(T1)};
+
+CW SW{-> MARK(T2)};
+
+SW SW{-> MARK(T3)};
+
+W+{-> MARK(T4)};
+
+W+ COMMA{-> MARK(T5)};
+
+(CW COMMA)+{-> MARK(T6)};
+
+(CW | SW){->MARK(T7)};
+
+(CW | SW)+{->MARK(T8)};
+
+(CW COMMA)+ CW{-> MARK(T9,1,2)};
+
+(CW (COMMA | SW))+{-> MARK(T10)};
+
+(CW (COMMA | SW))+ CW PERIOD+{-> MARK(T11,1,2,3)};
+
+(CW (COMMA | SW){-> MARK(T12), MARK(T13,1,2)})+{-> MARK(T14)}
+ CW PERIOD+;
+
+(((CW PM) CW){-> MARK(T15)} COMMA)
+ (CW SW (CW PERIOD){-> MARK(T16)})
+ {-> MARK(T17)};
+
+(ANY ANY){STARTSWITH(CW), ENDSWITH(PM) -> MARK(T18)};
\ No newline at end of file
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.txt?rev=1174101&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.txt (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.txt Thu Sep 22 12:54:30 2011
@@ -0,0 +1 @@
+Peter, Jochen, Flo und Georg.
\ No newline at end of file
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/test/resources/org/apache/uima/textmarker/RuleInferenceTest.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain