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 2012/08/09 18:07:18 UTC

svn commit: r1371274 [1/2] - in /uima/sandbox/trunk/TextMarker/uimaj-textmarker/src: main/java/org/apache/uima/textmarker/ main/java/org/apache/uima/textmarker/engine/ main/java/org/apache/uima/textmarker/rule/ main/resources/org/apache/uima/textmarker...

Author: pkluegl
Date: Thu Aug  9 16:07:18 2012
New Revision: 1371274

URL: http://svn.apache.org/viewvc?rev=1371274&view=rev
Log:
UIMA-2347
- added matching loop with entry point for break in greedy composed rule elements
- added test, but commented them, because they take too long

Added:
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest2.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest2.tm
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest2.txt
Modified:
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/ComposedRuleElement.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRuleElement.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/BasicEngine.xml
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/DynamicAnchoringTest2.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/PartOfTest.java
    uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest.tm

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java Thu Aug  9 16:07:18 2012
@@ -82,15 +82,19 @@ public class TextMarkerStream extends FS
 
   private boolean lowMemoryProfile;
 
+  private boolean simpleGreedyForComposed;
+
   private InferenceCrowd crowd;
 
+
   protected TextMarkerStream(CAS cas, FSIterator<AnnotationFS> current, Type basicType,
-          FilterManager filter, boolean lowMemoryProfile, InferenceCrowd crowd) {
+          FilterManager filter, boolean lowMemoryProfile, boolean simpleGreedyForComposed, InferenceCrowd crowd) {
     super();
     this.cas = cas;
     this.filter = filter;
     this.basicType = basicType;
     this.lowMemoryProfile = lowMemoryProfile;
+    this.simpleGreedyForComposed = simpleGreedyForComposed;
     this.crowd = crowd;
     AnnotationFS additionalWindow = filter.getWindowAnnotation();
     updateIterators(cas, basicType, filter, additionalWindow);
@@ -135,8 +139,8 @@ public class TextMarkerStream extends FS
     currentIt = filter.createFilteredIterator(cas, basicType);
   }
 
-  public TextMarkerStream(CAS cas, Type basicType, FilterManager filter, boolean lowMemoryProfile, InferenceCrowd crowd) {
-    this(cas, null, basicType, filter, lowMemoryProfile, crowd);
+  public TextMarkerStream(CAS cas, Type basicType, FilterManager filter, boolean lowMemoryProfile, boolean simpleGreedyForComposed, InferenceCrowd crowd) {
+    this(cas, null, basicType, filter, lowMemoryProfile, simpleGreedyForComposed, crowd);
   }
 
   public void initalizeBasics() {
@@ -264,12 +268,12 @@ public class TextMarkerStream extends FS
     FilterManager filterManager = new FilterManager(filter.getDefaultFilterTypes(),
             filter.getCurrentFilterTypes(), filter.getCurrentRetainTypes(), windowAnnotation,
             windowType, cas);
-    TextMarkerStream stream = new TextMarkerStream(cas, basicIt, basicType, filterManager, lowMemoryProfile, crowd);
+    TextMarkerStream stream = new TextMarkerStream(cas, basicIt, basicType, filterManager, lowMemoryProfile,simpleGreedyForComposed, crowd);
     return stream;
   }
 
   public FSIterator<AnnotationFS> copy() {
-    return new TextMarkerStream(cas, currentIt.copy(), basicType, filter, lowMemoryProfile, crowd);
+    return new TextMarkerStream(cas, currentIt.copy(), basicType, filter, lowMemoryProfile,simpleGreedyForComposed, crowd);
   }
 
   public AnnotationFS get() throws NoSuchElementException {
@@ -639,7 +643,7 @@ public class TextMarkerStream extends FS
 
   public TextMarkerStream getCompleteStream() {
     FilterManager defaultFilter = new FilterManager(filter.getDefaultFilterTypes(), getCas());
-    return new TextMarkerStream(getCas(), basicIt, basicType, defaultFilter, lowMemoryProfile, crowd);
+    return new TextMarkerStream(getCas(), basicIt, basicType, defaultFilter, lowMemoryProfile,simpleGreedyForComposed, crowd);
   }
 
   public int getHistogram(Type type) {
@@ -678,4 +682,12 @@ public class TextMarkerStream extends FS
     this.anchoringFactor = anchoringFactor;
   }
 
+  public boolean isSimpleGreedyForComposed() {
+       return simpleGreedyForComposed;
+  }
+
+  public void setSimpleGreedyForComposed(boolean simpleGreedyForComposed) {
+    this.simpleGreedyForComposed = simpleGreedyForComposed;
+  }
+
 }

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java Thu Aug  9 16:07:18 2012
@@ -122,6 +122,8 @@ public class TextMarkerEngine extends JC
   public static final String RELOAD_SCRIPT = "reloadScript";
 
   public static final String LOW_MEMORY_PROFILE = "lowMemoryProfile";
+  
+  public static final String SIMPLE_GREEDY_FOR_COMPOSED = "simpleGreedyForComposed";
 
   private String[] seeders;
 
@@ -175,6 +177,8 @@ public class TextMarkerEngine extends JC
 
   private Boolean lowMemoryProfile;
 
+  private Boolean simpleGreedyForComposed;
+  
   private Boolean createCreatedByInfo;
 
   private boolean initialized = false;
@@ -211,6 +215,7 @@ public class TextMarkerEngine extends JC
     dynamicAnchoring = (Boolean) aContext.getConfigParameterValue(DYNAMIC_ANCHORING);
     reloadScript = (Boolean) aContext.getConfigParameterValue(RELOAD_SCRIPT);
     lowMemoryProfile = (Boolean) aContext.getConfigParameterValue(LOW_MEMORY_PROFILE);
+    simpleGreedyForComposed = (Boolean) aContext.getConfigParameterValue(SIMPLE_GREEDY_FOR_COMPOSED);
 
     removeBasics = removeBasics == null ? false : removeBasics;
     createDebugInfo = createDebugInfo == null ? false : createDebugInfo;
@@ -225,6 +230,7 @@ public class TextMarkerEngine extends JC
     dynamicAnchoring = dynamicAnchoring == null ? false : dynamicAnchoring;
     reloadScript = reloadScript == null ? false : reloadScript;
     lowMemoryProfile = lowMemoryProfile == null ? false : lowMemoryProfile;
+    simpleGreedyForComposed = simpleGreedyForComposed == null ? false : simpleGreedyForComposed;
 
     this.context = aContext;
 
@@ -397,7 +403,7 @@ public class TextMarkerEngine extends JC
     FilterManager filter = new FilterManager(filterTypes, cas);
     Type basicType = typeSystem.getType(BASIC_TYPE);
     seedTypes = seedAnnotations(cas);
-    TextMarkerStream stream = new TextMarkerStream(cas, basicType, filter, lowMemoryProfile, crowd);
+    TextMarkerStream stream = new TextMarkerStream(cas, basicType, filter, lowMemoryProfile, simpleGreedyForComposed, crowd);
 
     stream.initalizeBasics();
     return stream;

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/ComposedRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/ComposedRuleElement.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/ComposedRuleElement.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/ComposedRuleElement.java Thu Aug  9 16:07:18 2012
@@ -84,18 +84,45 @@ public class ComposedRuleElement extends
           RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
           TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
           InferenceCrowd crowd) {
-    // TODO minimize recursion call for greedy rule elements
-    RuleElement nextElement = getNextElement(after, this);
-    if (nextElement != null) {
-      ComposedRuleElementMatch composedMatch = createComposedMatch(ruleMatch, containerMatch);
-      nextElement.continueMatch(after, annotation, ruleMatch, ruleApply, composedMatch,
-              sideStepOrigin, entryPoint, stream, crowd);
+    if (!stream.isSimpleGreedyForComposed()) {
+      continueMatch(after, annotation, ruleMatch, ruleApply, containerMatch, sideStepOrigin,
+              entryPoint, stream, crowd);
     } else {
-      fallback(after, false, annotation, ruleMatch, ruleApply, containerMatch, sideStepOrigin,
+      // HOTFIX
+      boolean stopMatching = false;
+      boolean failed = false;
+      AnnotationFS nextAnnotation = annotation;
+      while (!stopMatching) {
+        RuleElement nextElement = getNextElement(after, this);
+        if (nextElement != null) {
+          ComposedRuleElementMatch composedMatch = createComposedMatch(ruleMatch, containerMatch);
+          nextElement.continueMatch(after, nextAnnotation, ruleMatch, ruleApply, composedMatch,
+                  sideStepOrigin, this, stream, crowd);
+          ComposedRuleElementMatch parentContainerMatch = containerMatch.getContainerMatch();
+          List<RuleElementMatch> match = getMatch(ruleMatch, parentContainerMatch);
+          int lenghtBefore = match.size();
+          List<RuleElementMatch> evaluateMatches = quantifier.evaluateMatches(match, parent, crowd);
+          ruleMatch.setMatched(ruleMatch.matched() && evaluateMatches != null);
+          if (evaluateMatches.size() != lenghtBefore) {
+            failed = true;
+            stopMatching = true;
+          }
+          if (!quantifier.continueMatch(after, nextAnnotation, this, ruleMatch, containerMatch,
+                  stream, crowd)) {
+            stopMatching = true;
+          }
+          List<AnnotationFS> textsMatched = evaluateMatches.get(evaluateMatches.size() - 1)
+                  .getTextsMatched();
+          nextAnnotation = textsMatched.get(textsMatched.size() - 1);
+        } else {
+          stopMatching = true;
+        }
+      }
+      fallback(after, failed, nextAnnotation, ruleMatch, ruleApply, containerMatch, sideStepOrigin,
               entryPoint, stream, crowd);
     }
   }
-  
+
   public void fallbackContinue(boolean after, boolean failed, AnnotationFS annotation,
           RuleMatch ruleMatch, RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
           TextMarkerRuleElement sideStepOrigin, RuleElement entryPoint, TextMarkerStream stream,
@@ -108,7 +135,7 @@ public class ComposedRuleElement extends
     if (container == null) {
       fallback(after, failed, annotation, ruleMatch, ruleApply, containerMatch, sideStepOrigin,
               entryPoint, stream, crowd);
-    } else {
+    } else if (entryPoint == null) {
       ComposedRuleElementMatch parentContainerMatch = containerMatch.getContainerMatch();
       RuleElement nextElement = container.getNextElement(after, this);
       List<RuleElementMatch> match = getMatch(ruleMatch, parentContainerMatch);
@@ -151,6 +178,9 @@ public class ComposedRuleElement extends
     // TODO both directions!
     List<AnnotationFS> textsMatched = evaluateMatches.get(evaluateMatches.size() - 1)
             .getTextsMatched();
+    if (textsMatched.isEmpty()) {
+      return null;
+    }
     AnnotationFS backtrackedAnnotation = textsMatched.get(textsMatched.size() - 1);
     return backtrackedAnnotation;
   }
@@ -165,7 +195,6 @@ public class ComposedRuleElement extends
       parentElement.fallbackContinue(after, failed, annotation, ruleMatch, ruleApply,
               containerMatch, sideStepOrigin, entryPoint, stream, crowd);
     } else if (sideStepOrigin != null) {
-      // System.out.println("SIDESTEP: " + sideStepOrigin);
       sideStepOrigin.continueSideStep(after, ruleMatch, ruleApply, containerMatch, entryPoint,
               stream, crowd);
     } else {

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRuleElement.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRuleElement.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRuleElement.java Thu Aug  9 16:07:18 2012
@@ -162,7 +162,7 @@ public class TextMarkerRuleElement exten
     RuleElement nextRuleElement = getContainer().getNextElement(after, this);
     if (nextRuleElement != null) {
       nextRuleElement.continueMatch(after, eachAnchor, extendedMatch, ruleApply,
-              extendedContainerMatch, sideStepOrigin, null, stream, crowd);
+              extendedContainerMatch, sideStepOrigin, entryPoint, stream, crowd);
     } else if (getContainer() instanceof ComposedRuleElement) {
       ComposedRuleElement composed = (ComposedRuleElement) getContainer();
       composed.fallbackContinue(after, failed, eachAnchor, extendedMatch, ruleApply,
@@ -236,7 +236,7 @@ public class TextMarkerRuleElement exten
         containerMatch.addInnerMatch(this, failedMatch);
         ComposedRuleElement composed = (ComposedRuleElement) getContainer();
         composed.fallbackContinue(after, true, annotation, ruleMatch, ruleApply, containerMatch,
-                sideStepOrigin, null, stream, crowd);
+                sideStepOrigin, entryPoint, stream, crowd);
       }
     } else {
       List<RuleElementMatch> evaluateMatches = quantifier.evaluateMatches(matchInfo, parent, crowd);

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/BasicEngine.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/BasicEngine.xml?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/BasicEngine.xml (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/BasicEngine.xml Thu Aug  9 16:07:18 2012
@@ -1,23 +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.
--->
-
 <analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
   <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
   <primitive>true</primitive>
@@ -149,6 +130,12 @@
         <multiValued>false</multiValued>
         <mandatory>false</mandatory>
       </configurationParameter>
+      <configurationParameter>
+        <name>simpleGreedyForComposed</name>
+        <type>Boolean</type>
+        <multiValued>false</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
     </configurationParameters>
     <configurationParameterSettings>
       <nameValuePair>

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/DynamicAnchoringTest2.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/DynamicAnchoringTest2.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/DynamicAnchoringTest2.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/DynamicAnchoringTest2.java Thu Aug  9 16:07:18 2012
@@ -37,7 +37,7 @@ public class DynamicAnchoringTest2 {
     CAS cas = null;
     try {
       cas = TextMarkerTestUtils.process(namespace + "/" + name + ".tm", namespace + "/" + name
-              + ".txt", 50, true,  null, null);
+              + ".txt", 50, true, false, null, null);
     } catch (Exception e) {
       e.printStackTrace();
       assert (false);

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest.java Thu Aug  9 16:07:18 2012
@@ -19,6 +19,7 @@
 
 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;
@@ -50,7 +51,7 @@ public class LongGreedyTest {
 //    iterator = ai.iterator();
 //    String coveredText = iterator.next().getCoveredText();
 //    assertEquals(64998, coveredText.length());
-
+    
     if (cas != null) {
       cas.release();
     }

Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest2.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest2.java?rev=1371274&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest2.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LongGreedyTest2.java Thu Aug  9 16:07:18 2012
@@ -0,0 +1,60 @@
+/*
+ * 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 LongGreedyTest2 {
+
+  @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, false, true, null, null);
+    } catch (Exception e) {
+      e.printStackTrace();
+      assert (false);
+    }
+    Type t = null;
+    AnnotationIndex<AnnotationFS> ai = null;
+    FSIterator<AnnotationFS> iterator = null;
+
+    // t = TextMarkerTestUtils.getTestType(cas, 2);
+    // ai = cas.getAnnotationIndex(t);
+    // assertEquals(1, ai.size());
+    // iterator = ai.iterator();
+    // String coveredText2 = iterator.next().getCoveredText();
+    // assertEquals(64998, coveredText2.length());
+
+    if (cas != null) {
+      cas.release();
+    }
+
+  }
+}

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/TextMarkerTestUtils.java Thu Aug  9 16:07:18 2012
@@ -53,11 +53,11 @@ public class TextMarkerTestUtils {
           throws URISyntaxException, IOException, InvalidXMLException,
           ResourceInitializationException, AnalysisEngineProcessException,
           ResourceConfigurationException {
-    return process(ruleFileName, textFileName, amount, false, null, null);
+    return process(ruleFileName, textFileName, amount, false, false, null, null);
   }
 
   public static CAS process(String ruleFileName, String textFileName, int amount,
-          boolean dynamicAnchoring, Map<String, String> complexTypes, String resourceDirName)
+          boolean dynamicAnchoring, boolean simpleGreedyForComposed, Map<String, String> complexTypes, String resourceDirName)
           throws URISyntaxException, IOException, InvalidXMLException,
           ResourceInitializationException, AnalysisEngineProcessException,
           ResourceConfigurationException {
@@ -105,6 +105,7 @@ public class TextMarkerTestUtils {
     }
     ae.setConfigParameterValue(TextMarkerEngine.MAIN_SCRIPT, name);
     ae.setConfigParameterValue(TextMarkerEngine.DYNAMIC_ANCHORING, dynamicAnchoring);
+    ae.setConfigParameterValue(TextMarkerEngine.SIMPLE_GREEDY_FOR_COMPOSED, simpleGreedyForComposed);
     if (resourceFile != null) {
       ae.setConfigParameterValue(TextMarkerEngine.RESOURCE_PATHS,
               new String[] { resourceFile.getPath() });

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java Thu Aug  9 16:07:18 2012
@@ -36,11 +36,10 @@ public class MarkFastTest {
     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, false, null, namespace + "/");
+              + ".txt", 50, false, false, null, namespace + "/");
     } catch (Exception e) {
       e.printStackTrace();
       assert (false);
@@ -56,11 +55,11 @@ public class MarkFastTest {
     assertEquals("1 0 0", iterator.next().getCoveredText());
     assertEquals("100", iterator.next().getCoveredText());
     assertEquals("2 0 0", iterator.next().getCoveredText());
- 
+
     t = TextMarkerTestUtils.getTestType(cas, 2);
     ai = cas.getAnnotationIndex(t);
     assertEquals(0, ai.size());
- 
+
     t = TextMarkerTestUtils.getTestType(cas, 3);
     ai = cas.getAnnotationIndex(t);
     assertEquals(3, ai.size());
@@ -75,6 +74,6 @@ public class MarkFastTest {
     iterator = ai.iterator();
     assertEquals("1 0 0", iterator.next().getCoveredText());
     assertEquals("2 0 0", iterator.next().getCoveredText());
-    
+
   }
 }

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/PartOfTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/PartOfTest.java?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/PartOfTest.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/PartOfTest.java Thu Aug  9 16:07:18 2012
@@ -46,7 +46,7 @@ public class PartOfTest {
     CAS cas = null;
     try {
       cas = TextMarkerTestUtils.process(namespace + "/" + name + ".tm", namespace + "/" + name
-              + ".txt", 50, false, complexTypes, null);
+              + ".txt", 50, false, false, complexTypes, null);
     } catch (Exception e) {
       e.printStackTrace();
       assert (false);

Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest.tm?rev=1371274&r1=1371273&r2=1371274&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest.tm (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest.tm Thu Aug  9 16:07:18 2012
@@ -3,4 +3,3 @@ 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,T21,T22,T23,T24,T25;
 
 W+{-PARTOF(T1) -> MARK(T1)};
-//(W W)+{-PARTOF(T2) -> MARK(T2)};

Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest2.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest2.tm?rev=1371274&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest2.tm (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LongGreedyTest2.tm Thu Aug  9 16:07:18 2012
@@ -0,0 +1,5 @@
+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,T21,T22,T23,T24,T25;
+
+(W W)+{-PARTOF(T2) -> MARK(T2)};