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 2013/10/28 18:02:40 UTC

svn commit: r1536410 - in /uima/sandbox/ruta/trunk: ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/ ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/output/ ruta-core/src/main/java/org/apache/uima/ruta/ ruta-core/src/main/java/org/apache/ui...

Author: pkluegl
Date: Mon Oct 28 17:02:40 2013
New Revision: 1536410

URL: http://svn.apache.org/r1536410
Log:
UIMA-2768
- added option for greedy anchoring
- added parameter and action
- extended documentation
- added simple test

Added:
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GreedyAnchoringAction.java   (with props)
    uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/GreedyAnchoringTest.java   (with props)
Removed:
    uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/output/
    uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/output/
Modified:
    uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.g
    uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.tokens
    uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g
    uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.tokens
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/ActionFactory.java
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRule.java
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRuleElement.java
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java
    uima/sandbox/ruta/trunk/ruta-core/src/main/resources/org/apache/uima/ruta/engine/BasicEngine.xml
    uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/TestEngine.xml
    uima/sandbox/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.actions.xml
    uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.g
    uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.tokens
    uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
    uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.tokens
    uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/RutaKeywords.java

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.g
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.g?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.g (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.g Mon Oct 28 17:02:40 2013
@@ -252,6 +252,10 @@ DYNAMICANCHORING 	
 	:	'DYNAMICANCHORING'	 
 	;
 
+GREEDYANCHORING 	
+	:	'GREEDYANCHORING'	 
+	;
+
 TRIM
   : 'TRIM'
   ;

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.tokens
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.tokens?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.tokens (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaLexer.tokens Mon Oct 28 17:02:40 2013
@@ -1,157 +1,160 @@
-STAR=143
-FloatTypeSuffix=119
-OctalLiteral=117
+STAR=146
+FloatTypeSuffix=122
+OctalLiteral=120
 LOG=37
 CONTAINS=8
-REMOVE=70
-GREATEREQUAL=156
+REMOVE=72
+GREATEREQUAL=159
 MARKFAST=41
-CONDITION=96
-MATCHEDTEXT=76
+CONDITION=99
+MATCHEDTEXT=78
 COUNT=14
-LOGN=105
-DYNAMICANCHORING=57
-NOT=68
-Identifier=129
-ACTION=97
-NOTEQUAL=153
-CLEAR=78
-VBAR=145
-DOUBLELIST=100
-ENDSWITH=63
-RPAREN=131
+LOGN=108
+DYNAMICANCHORING=58
+NOT=70
+Identifier=132
+ACTION=100
+NOTEQUAL=156
+CLEAR=80
+VBAR=148
+DOUBLELIST=103
+ENDSWITH=65
+RPAREN=134
 CREATE=31
-GREATER=148
-SIN=106
-EXP=104
+GREATER=151
+SIN=109
+EXP=107
 CURRENTCOUNT=16
-COS=107
-TAN=108
-TYPELIST=103
-FloatString=91
-LESS=147
+COS=110
+TAN=111
+TYPELIST=106
+FloatString=94
+LESS=150
 REGEXP=25
-GET=73
+GET=75
 PARTOF=22
-UNMARK=53
+UNMARK=54
 LAST=18
-COMMENT=159
-REMOVEDUPLICATE=71
-UNMARKALL=54
-RBRACK=133
+COMMENT=162
+REMOVEDUPLICATE=73
+UNMARKALL=55
+RBRACK=136
 NEAR=20
-LINE_COMMENT=160
-IntegerTypeSuffix=114
+GREEDYANCHORING=59
+LINE_COMMENT=163
+IntegerTypeSuffix=117
 MARKSCORE=39
-REMOVESTRING=77
-TRANSFER=55
-LCURLY=134
+REMOVESTRING=79
+TRANSFER=56
+LCURLY=137
 TRIE=7
-FILTERTYPE=46
-STRINGLIST=102
+FILTERTYPE=47
+MARKFIRST=44
+STRINGLIST=105
 MARKONCE=40
-ScriptString=83
-EngineString=84
-WS=158
+ScriptString=86
+EngineString=87
+WS=161
 WORDTABLE=11
 WORDLIST=10
-AutomataBlockString=87
-FloatingPointLiteral=120
-STARTANCHOR=112
-INTLIST=99
+AutomataBlockString=90
+FloatingPointLiteral=123
+STARTANCHOR=115
+INTLIST=102
 OR=21
-TRIM=58
-JavaIDDigit=128
-FLOATLIST=101
-CALL=47
+TRIM=60
+JavaIDDigit=131
+FLOATLIST=104
+CALL=48
 Annotation=5
-FALSE=111
-LESSEQUAL=155
-RessourceLiteral=124
+FALSE=114
+LESSEQUAL=158
+RessourceLiteral=127
 VOTE=27
-Letter=127
-EscapeSequence=121
-SIZE=75
-REMOVEFILTERTYPE=67
-LBRACK=132
-CharacterLiteral=122
+Letter=130
+EscapeSequence=124
+SIZE=77
+REMOVEFILTERTYPE=69
+LBRACK=135
+CharacterLiteral=125
 DEL=36
 ATTRIBUTE=34
-TypeString=88
-SHIFT=56
-Exponent=118
-ASSIGN_EQUAL=149
-RETAINTYPE=45
-TypeSystemString=94
+TypeString=91
+SHIFT=57
+Exponent=121
+THEN2=82
+ASSIGN_EQUAL=152
+RETAINTYPE=46
+TypeSystemString=97
 AND=12
-ADDFILTERTYPE=66
-BlockString=86
-IntString=89
-HexDigit=113
+IntString=92
+ADDFILTERTYPE=68
+BlockString=89
+HexDigit=116
 COLOR=35
-LPAREN=130
+LPAREN=133
 POSITION=24
 IF=28
-LogLevel=80
-CONFIGURE=49
-SLASH=144
-THEN=79
+LogLevel=83
+CONFIGURE=50
+SLASH=147
+THEN=81
 FILL=33
-COMMA=139
-IS=61
-AMPER=146
-REPLACE=44
-GETLIST=74
-WILDCARD=157
-EQUAL=152
+COMMA=142
+IS=63
+AMPER=149
+REPLACE=45
+GETLIST=76
+WILDCARD=160
+EQUAL=155
 GATHER=32
 INLIST=17
-PLUS=141
-BooleanString=93
-GETFEATURE=52
-DOT=137
+PLUS=144
+BooleanString=96
+GETFEATURE=53
+DOT=140
 ListIdentifier=6
 PARTOFNEQ=23
-BOOLEANLIST=98
-ADD=69
+BOOLEANLIST=101
+ADD=71
 MARKTABLE=42
-HexLiteral=115
-XOR=109
-PERCENT=150
+HexLiteral=118
+XOR=112
+PERCENT=153
 MARK=38
 PARSE=30
-PackageString=82
-OldColor=81
+PackageString=85
+OldColor=84
 MARKLAST=43
-MERGE=72
+MERGE=74
 CONTEXTCOUNT=13
-BEFORE=59
-EXEC=48
-MINUS=142
-AFTER=60
-DecimalLiteral=116
-SEMI=140
-TRUE=110
+BEFORE=61
+EXEC=49
+MINUS=145
+AFTER=62
+DecimalLiteral=119
+SEMI=143
+TRUE=113
 FEATURE=29
-SymbolString=95
-COLON=138
-StringLiteral=123
-StringString=92
+SymbolString=98
+COLON=141
+StringLiteral=126
+StringString=95
 SCORE=26
-QUESTION=151
-ADDRETAINTYPE=64
-UnicodeEscape=125
-RCURLY=135
-STARTSWITH=62
-ASSIGN=50
-REMOVERETAINTYPE=65
+QUESTION=154
+ADDRETAINTYPE=66
+UnicodeEscape=128
+RCURLY=138
+STARTSWITH=64
+ASSIGN=51
+REMOVERETAINTYPE=67
 TOTALCOUNT=15
 DECLARE=9
-UimafitString=85
+UimafitString=88
 DocComment=4
 MOFN=19
-OctalEscape=126
-SETFEATURE=51
-DoubleString=90
-CIRCUMFLEX=136
-ALT_NOTEQUAL=154
+OctalEscape=129
+SETFEATURE=52
+DoubleString=93
+CIRCUMFLEX=139
+ALT_NOTEQUAL=157

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.g Mon Oct 28 17:02:40 2013
@@ -1318,6 +1318,7 @@ action  returns [AbstractRutaAction resu
 	| a = actionShift
 	| a = actionConfigure
 	| a = actionDynamicAnchoring
+	| a = actionGreedyAnchoring
 	| a = actionTrim 
 	| a = actionAddRetainType
 	| a = actionRemoveRetainType
@@ -1644,6 +1645,13 @@ actionDynamicAnchoring returns [Abstract
     RPAREN
     ;
 
+actionGreedyAnchoring returns [AbstractRutaAction action = null]
+    :
+    name = GREEDYANCHORING LPAREN active = booleanExpression 
+    {action = ActionFactory.createGreedyAnchoringAction(active, $blockDeclaration::env);}
+    RPAREN
+    ;
+
 actionTrim returns [AbstractRutaAction action = null]
 @init {
   List<TypeExpression> types = new ArrayList<TypeExpression>();

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.tokens
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.tokens?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.tokens (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/antlr3/org/apache/uima/ruta/parser/RutaParser.tokens Mon Oct 28 17:02:40 2013
@@ -1,157 +1,160 @@
-STAR=143
-FloatTypeSuffix=119
-OctalLiteral=117
+STAR=146
+FloatTypeSuffix=122
+OctalLiteral=120
 LOG=37
 CONTAINS=8
-REMOVE=70
-GREATEREQUAL=156
+REMOVE=72
+GREATEREQUAL=159
 MARKFAST=41
-CONDITION=96
-MATCHEDTEXT=76
+CONDITION=99
+MATCHEDTEXT=78
 COUNT=14
-LOGN=105
-DYNAMICANCHORING=57
-NOT=68
-Identifier=129
-ACTION=97
-CLEAR=78
-NOTEQUAL=153
-ENDSWITH=63
-DOUBLELIST=100
-VBAR=145
-RPAREN=131
+LOGN=108
+DYNAMICANCHORING=58
+NOT=70
+Identifier=132
+ACTION=100
+CLEAR=80
+NOTEQUAL=156
+ENDSWITH=65
+DOUBLELIST=103
+VBAR=148
+RPAREN=134
 CREATE=31
-GREATER=148
-SIN=106
-EXP=104
+GREATER=151
+SIN=109
+EXP=107
 CURRENTCOUNT=16
-COS=107
-TAN=108
-TYPELIST=103
-FloatString=91
-LESS=147
+COS=110
+TAN=111
+TYPELIST=106
+FloatString=94
+LESS=150
 REGEXP=25
-GET=73
-UNMARK=53
+GET=75
+UNMARK=54
 PARTOF=22
 LAST=18
-COMMENT=159
-REMOVEDUPLICATE=71
-UNMARKALL=54
-RBRACK=133
+COMMENT=162
+REMOVEDUPLICATE=73
+UNMARKALL=55
+RBRACK=136
 NEAR=20
-LINE_COMMENT=160
-IntegerTypeSuffix=114
+GREEDYANCHORING=59
+LINE_COMMENT=163
+IntegerTypeSuffix=117
 MARKSCORE=39
-REMOVESTRING=77
-TRANSFER=55
-LCURLY=134
+REMOVESTRING=79
+TRANSFER=56
+LCURLY=137
 TRIE=7
-FILTERTYPE=46
-STRINGLIST=102
+FILTERTYPE=47
+MARKFIRST=44
+STRINGLIST=105
 MARKONCE=40
-ScriptString=83
-EngineString=84
-WS=158
+ScriptString=86
+EngineString=87
+WS=161
 WORDTABLE=11
 WORDLIST=10
-AutomataBlockString=87
-FloatingPointLiteral=120
-STARTANCHOR=112
-INTLIST=99
+AutomataBlockString=90
+FloatingPointLiteral=123
+STARTANCHOR=115
+INTLIST=102
 OR=21
-TRIM=58
-JavaIDDigit=128
-FLOATLIST=101
-CALL=47
+TRIM=60
+JavaIDDigit=131
+FLOATLIST=104
+CALL=48
 Annotation=5
-FALSE=111
-LESSEQUAL=155
-RessourceLiteral=124
+FALSE=114
+LESSEQUAL=158
+RessourceLiteral=127
 VOTE=27
-Letter=127
-EscapeSequence=121
-SIZE=75
-REMOVEFILTERTYPE=67
-LBRACK=132
-CharacterLiteral=122
+Letter=130
+EscapeSequence=124
+SIZE=77
+REMOVEFILTERTYPE=69
+LBRACK=135
+CharacterLiteral=125
 DEL=36
 ATTRIBUTE=34
-TypeString=88
-SHIFT=56
-Exponent=118
-ASSIGN_EQUAL=149
-RETAINTYPE=45
-TypeSystemString=94
+TypeString=91
+SHIFT=57
+Exponent=121
+THEN2=82
+ASSIGN_EQUAL=152
+RETAINTYPE=46
 AND=12
-IntString=89
-ADDFILTERTYPE=66
-BlockString=86
-HexDigit=113
+TypeSystemString=97
+BlockString=89
+ADDFILTERTYPE=68
+IntString=92
+HexDigit=116
 COLOR=35
 POSITION=24
-LPAREN=130
+LPAREN=133
 IF=28
-LogLevel=80
-CONFIGURE=49
-SLASH=144
-THEN=79
+LogLevel=83
+CONFIGURE=50
+SLASH=147
+THEN=81
 FILL=33
-COMMA=139
-IS=61
-GETLIST=74
-REPLACE=44
-AMPER=146
-WILDCARD=157
-EQUAL=152
+COMMA=142
+IS=63
+GETLIST=76
+REPLACE=45
+AMPER=149
+WILDCARD=160
+EQUAL=155
 GATHER=32
 INLIST=17
-PLUS=141
-BooleanString=93
-GETFEATURE=52
-DOT=137
+PLUS=144
+BooleanString=96
+GETFEATURE=53
+DOT=140
 ListIdentifier=6
 PARTOFNEQ=23
-ADD=69
-BOOLEANLIST=98
+ADD=71
+BOOLEANLIST=101
 MARKTABLE=42
-HexLiteral=115
-XOR=109
+HexLiteral=118
+XOR=112
 MARK=38
-PERCENT=150
-PackageString=82
+PERCENT=153
+PackageString=85
 PARSE=30
-OldColor=81
-MERGE=72
+OldColor=84
+MERGE=74
 MARKLAST=43
 CONTEXTCOUNT=13
-BEFORE=59
-EXEC=48
-AFTER=60
-MINUS=142
-DecimalLiteral=116
-TRUE=110
-SEMI=140
+BEFORE=61
+EXEC=49
+AFTER=62
+MINUS=145
+DecimalLiteral=119
+TRUE=113
+SEMI=143
 FEATURE=29
-SymbolString=95
-StringString=92
-StringLiteral=123
-COLON=138
+SymbolString=98
+StringString=95
+StringLiteral=126
+COLON=141
 SCORE=26
-QUESTION=151
-ADDRETAINTYPE=64
-UnicodeEscape=125
-STARTSWITH=62
-RCURLY=135
-ASSIGN=50
-REMOVERETAINTYPE=65
+QUESTION=154
+ADDRETAINTYPE=66
+UnicodeEscape=128
+STARTSWITH=64
+RCURLY=138
+ASSIGN=51
+REMOVERETAINTYPE=67
 TOTALCOUNT=15
-UimafitString=85
+UimafitString=88
 DECLARE=9
 DocComment=4
 MOFN=19
-SETFEATURE=51
-OctalEscape=126
-DoubleString=90
-CIRCUMFLEX=136
-ALT_NOTEQUAL=154
+SETFEATURE=52
+OctalEscape=129
+DoubleString=93
+CIRCUMFLEX=139
+ALT_NOTEQUAL=157

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java Mon Oct 28 17:02:40 2013
@@ -80,6 +80,8 @@ public class RutaStream extends FSIterat
 
   private InferenceCrowd crowd;
 
+  private Boolean greedyAnchoring;
+
   protected RutaStream(CAS cas, FSIterator<AnnotationFS> current, Type basicType,
           FilterManager filter, boolean lowMemoryProfile, boolean simpleGreedyForComposed,
           InferenceCrowd crowd) {
@@ -345,12 +347,17 @@ public class RutaStream extends FSIterat
             windowType, cas);
     RutaStream stream = new RutaStream(cas, basicIt, basicType, filterManager, lowMemoryProfile,
             simpleGreedyForComposed, crowd);
+    stream.setDynamicAnchoring(dynamicAnchoring);
+    stream.setGreedyAnchoring(greedyAnchoring);
     return stream;
   }
 
   public FSIterator<AnnotationFS> copy() {
-    return new RutaStream(cas, currentIt.copy(), basicType, filter, lowMemoryProfile,
+    RutaStream stream = new RutaStream(cas, currentIt.copy(), basicType, filter, lowMemoryProfile,
             simpleGreedyForComposed, crowd);
+    stream.setDynamicAnchoring(dynamicAnchoring);
+    stream.setGreedyAnchoring(greedyAnchoring);
+    return stream;
   }
 
   public AnnotationFS get() throws NoSuchElementException {
@@ -692,8 +699,11 @@ public class RutaStream extends FSIterat
 
   public RutaStream getCompleteStream() {
     FilterManager defaultFilter = new FilterManager(filter.getDefaultFilterTypes(), getCas());
-    return new RutaStream(getCas(), basicIt, basicType, defaultFilter, lowMemoryProfile,
+    RutaStream stream = new RutaStream(getCas(), basicIt, basicType, defaultFilter, lowMemoryProfile,
             simpleGreedyForComposed, crowd);
+    stream.setDynamicAnchoring(dynamicAnchoring);
+    stream.setGreedyAnchoring(greedyAnchoring);
+    return stream;
   }
 
   public long getHistogram(Type type) {
@@ -719,7 +729,15 @@ public class RutaStream extends FSIterat
   public void setDynamicAnchoring(boolean dynamicAnchoring) {
     this.dynamicAnchoring = dynamicAnchoring;
   }
-
+  
+  public boolean isGreedyAnchoring() {
+    return greedyAnchoring;
+  }
+  
+  public void setGreedyAnchoring(Boolean greedyAnchoring) {
+    this.greedyAnchoring = greedyAnchoring;
+  }
+  
   public void setIndexPenalty(double indexPenalty) {
     this.indexPenalty = indexPenalty;
   }
@@ -766,5 +784,7 @@ public class RutaStream extends FSIterat
       return getBeginAnchor(annotation.getBegin());
     }
   }
+
+
   
 }

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/ActionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/ActionFactory.java?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/ActionFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/ActionFactory.java Mon Oct 28 17:02:40 2013
@@ -273,4 +273,9 @@ public class ActionFactory {
     return new MarkFirstAction(type);
   }
 
+  public static AbstractRutaAction createGreedyAnchoringAction(BooleanExpression active,
+          RutaBlock env) {
+    return new GreedyAnchoringAction(active);
+  }
+
 }

Added: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GreedyAnchoringAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GreedyAnchoringAction.java?rev=1536410&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GreedyAnchoringAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GreedyAnchoringAction.java Mon Oct 28 17:02:40 2013
@@ -0,0 +1,50 @@
+/*
+ * 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.ruta.action;
+
+import org.apache.uima.ruta.RutaBlock;
+import org.apache.uima.ruta.RutaStream;
+import org.apache.uima.ruta.expression.bool.BooleanExpression;
+import org.apache.uima.ruta.rule.RuleElement;
+import org.apache.uima.ruta.rule.RuleMatch;
+import org.apache.uima.ruta.visitor.InferenceCrowd;
+
+public class GreedyAnchoringAction extends AbstractRutaAction {
+
+  private final BooleanExpression active;
+
+  public GreedyAnchoringAction(BooleanExpression active) {
+    super();
+    this.active = active;
+  }
+
+  @Override
+  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
+    RutaBlock parent = element.getParent();
+    boolean activated = active.getBooleanValue(parent, null, stream);
+    stream.setGreedyAnchoring(activated);
+  }
+
+  public BooleanExpression getActive() {
+    return active;
+  }
+
+
+}

Propchange: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/action/GreedyAnchoringAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/RutaEngine.java Mon Oct 28 17:02:40 2013
@@ -271,6 +271,17 @@ public class RutaEngine extends JCasAnno
   private Boolean simpleGreedyForComposed;
 
   /**
+   * If this parameter is set to true, then start positions already matched by the same rule will be ignored. This situation 
+   * occurs mostly for rules that start with a quantifier. The following rule, for example, matches only once, 
+   * if this parameter is set to true: {@code ANY+;}
+   */
+  public static final String PARAM_GREEDY_ANCHORING = "greedyAnchoring";
+
+  @ConfigurationParameter(name = PARAM_GREEDY_ANCHORING, mandatory = false, defaultValue = "false")
+  private Boolean greedyAnchoring = false;
+  
+  
+  /**
    * If this parameter is set to true, then additional information about the execution of a rule
    * script is added to the CAS. The actual information is specified by the following parameters.
    * The default value of this parameter is set to false.
@@ -281,7 +292,7 @@ public class RutaEngine extends JCasAnno
   private Boolean debug;
 
   /**
-   * This parameter specificies whether the match information (covered text) of the rules should be
+   * This parameter specifies whether the match information (covered text) of the rules should be
    * stored in the CAS. The default value of this parameter is set to false.
    */
   public static final String PARAM_DEBUG_WITH_MATCHES = "debugWithMatches";
@@ -323,6 +334,9 @@ public class RutaEngine extends JCasAnno
    */
   public static final String PARAM_CREATED_BY = "createdBy";
 
+  @ConfigurationParameter(name = PARAM_CREATED_BY, mandatory = false, defaultValue = "false")
+  private Boolean createdBy;
+
   /**
    * If this parameter is set to true, then only types in declared type systems are available by their short name.
    */
@@ -331,9 +345,6 @@ public class RutaEngine extends JCasAnno
   @ConfigurationParameter(name = PARAM_STRICT_IMPORTS, mandatory = false, defaultValue = "false")
   private Boolean strictImports = false;
 
-  @ConfigurationParameter(name = PARAM_CREATED_BY, mandatory = false, defaultValue = "false")
-  private Boolean createdBy;
-
   private UimaContext context;
 
   private RutaModule script;
@@ -387,6 +398,8 @@ public class RutaEngine extends JCasAnno
     lowMemoryProfile = (Boolean) aContext.getConfigParameterValue(PARAM_LOW_MEMORY_PROFILE);
     simpleGreedyForComposed = (Boolean) aContext
             .getConfigParameterValue(PARAM_SIMPLE_GREEDY_FOR_COMPOSED);
+    greedyAnchoring = (Boolean) aContext
+            .getConfigParameterValue(PARAM_GREEDY_ANCHORING);
 
     resourcePaths = resourcePaths == null ? new String[0] : resourcePaths;
     removeBasics = removeBasics == null ? false : removeBasics;
@@ -403,7 +416,9 @@ public class RutaEngine extends JCasAnno
     reloadScript = reloadScript == null ? false : reloadScript;
     lowMemoryProfile = lowMemoryProfile == null ? false : lowMemoryProfile;
     simpleGreedyForComposed = simpleGreedyForComposed == null ? false : simpleGreedyForComposed;
+    greedyAnchoring = greedyAnchoring == null ? false : greedyAnchoring;
 
+    
     this.context = aContext;
 
     factory = new RutaExternalFactory();
@@ -443,6 +458,7 @@ public class RutaEngine extends JCasAnno
     InferenceCrowd crowd = initializeCrowd();
     RutaStream stream = initializeStream(cas, crowd);
     stream.setDynamicAnchoring(dynamicAnchoring);
+    stream.setGreedyAnchoring(greedyAnchoring);
     try {
       script.apply(stream, crowd);
     } catch (Throwable e) {

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRule.java?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRule.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRule.java Mon Oct 28 17:02:40 2013
@@ -37,7 +37,7 @@ public class RutaRule extends AbstractRu
 
   @Override
   public RuleApply apply(RutaStream stream, InferenceCrowd crowd) {
-    return apply(stream, crowd, false);
+    return apply(stream, crowd, stream.isGreedyAnchoring());
   }
 
   public RuleApply apply(RutaStream stream, InferenceCrowd crowd, boolean remember) {

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRuleElement.java?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRuleElement.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/RutaRuleElement.java Mon Oct 28 17:02:40 2013
@@ -57,6 +57,9 @@ public class RutaRuleElement extends Abs
     Collection<AnnotationFS> anchors = getAnchors(stream);
     boolean useAlternatives = anchors.size() != 1;
     for (AnnotationFS eachAnchor : anchors) {
+      if(stream.isGreedyAnchoring() && isAlreadyCovered(eachAnchor, ruleApply, stream)) {
+        continue;
+      }
       ComposedRuleElementMatch extendedContainerMatch = containerMatch;
       RuleMatch extendedMatch = ruleMatch;
       if (useAlternatives) {
@@ -115,6 +118,22 @@ public class RutaRuleElement extends Abs
     return result;
   }
 
+  private boolean isAlreadyCovered(AnnotationFS eachAnchor, RuleApply ruleApply, RutaStream stream) {
+    List<AbstractRuleMatch<? extends AbstractRule>> list = ruleApply.getList();
+    Collections.reverse(list);
+    for (AbstractRuleMatch<? extends AbstractRule> each : list) {
+      if(each instanceof RuleMatch) {
+        RuleMatch rm = (RuleMatch) each;
+        List<AnnotationFS> matchedAnnotationsOf = rm.getMatchedAnnotationsOf(this);
+        for (AnnotationFS annotationFS : matchedAnnotationsOf) {
+          if(eachAnchor.getBegin() >= annotationFS.getBegin() && eachAnchor.getEnd() <= annotationFS.getEnd())
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
   public List<RuleMatch> continueOwnMatch(boolean after, AnnotationFS annotation,
           RuleMatch ruleMatch, RuleApply ruleApply, ComposedRuleElementMatch containerMatch,
           RutaRuleElement sideStepOrigin, RuleElement entryPoint, RutaStream stream,

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/verbalize/ActionVerbalizer.java Mon Oct 28 17:02:40 2013
@@ -40,6 +40,7 @@ import org.apache.uima.ruta.action.Gathe
 import org.apache.uima.ruta.action.GetAction;
 import org.apache.uima.ruta.action.GetFeatureAction;
 import org.apache.uima.ruta.action.GetListAction;
+import org.apache.uima.ruta.action.GreedyAnchoringAction;
 import org.apache.uima.ruta.action.ImplicitFeatureAction;
 import org.apache.uima.ruta.action.ImplicitMarkAction;
 import org.apache.uima.ruta.action.LogAction;
@@ -148,6 +149,8 @@ public class ActionVerbalizer {
       return "CONFIGURE";
     } else if (action instanceof DynamicAnchoringAction) {
       return "DYNAMICANCHORING";
+    } else if (action instanceof GreedyAnchoringAction) {
+      return "GREEDYANCHORING";
     } else if (action instanceof GetListAction) {
       return "GETLIST";
     } else if (action instanceof MarkTableAction) {
@@ -422,6 +425,11 @@ public class ActionVerbalizer {
       String pp = panelty == null ? "" : ", " + verbalizer.verbalize(panelty);
       String pf = factor == null ? "" : ", " + verbalizer.verbalize(factor);
       return name + pa + pp + pf + ")";
+    } else if (action instanceof GreedyAnchoringAction) {
+      GreedyAnchoringAction a = (GreedyAnchoringAction) action;
+      BooleanExpression active = a.getActive();
+      String pa = verbalizer.verbalize(active);
+      return name + pa + ")";
     } else if (action instanceof GetListAction) {
       GetListAction a = (GetListAction) action;
       String var = a.getVar();

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/resources/org/apache/uima/ruta/engine/BasicEngine.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/resources/org/apache/uima/ruta/engine/BasicEngine.xml?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/resources/org/apache/uima/ruta/engine/BasicEngine.xml (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/resources/org/apache/uima/ruta/engine/BasicEngine.xml Mon Oct 28 17:02:40 2013
@@ -132,7 +132,14 @@
       </configurationParameter>
       <configurationParameter>
         <name>dynamicAnchoring</name>
-        <description>Activates dynamic achoring (possible speed up).</description>
+        <description>Activates dynamic anchoring (possible speed up).</description>
+        <type>Boolean</type>
+        <multiValued>false</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>greedyAnchoring</name>
+        <description>Activates greedy anchoring.</description>
         <type>Boolean</type>
         <multiValued>false</multiValued>
         <mandatory>false</mandatory>

Added: uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/GreedyAnchoringTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/GreedyAnchoringTest.java?rev=1536410&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/GreedyAnchoringTest.java (added)
+++ uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/GreedyAnchoringTest.java Mon Oct 28 17:02:40 2013
@@ -0,0 +1,77 @@
+/*
+ * 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.ruta;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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.apache.uima.ruta.engine.Ruta;
+import org.apache.uima.ruta.engine.RutaEngine;
+import org.junit.Test;
+
+public class GreedyAnchoringTest {
+
+  @Test
+  public void test() {
+    String document = "Peter Kluegl, Joern Kottmann, Marshall Schor.";
+    String script = "";
+    script += "ANY+{->T1};";
+    script += "ANY*{->T2};";
+    
+    CAS cas = null;
+    Map<String, Object> params = new HashMap<String, Object>();
+    params.put(RutaEngine.PARAM_GREEDY_ANCHORING, true);
+    try {
+      cas = RutaTestUtils.getCAS(document);
+      Ruta.apply(cas, script, params);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+
+    Type t = null;
+    AnnotationIndex<AnnotationFS> ai = null;
+    FSIterator<AnnotationFS> iterator = null;
+
+    t = RutaTestUtils.getTestType(cas, 1);
+    ai = cas.getAnnotationIndex(t);
+    assertEquals(1, ai.size());
+    iterator = ai.iterator();
+    assertEquals(document, iterator.next().getCoveredText());
+    
+    t = RutaTestUtils.getTestType(cas, 2);
+    ai = cas.getAnnotationIndex(t);
+    assertEquals(1, ai.size());
+    iterator = ai.iterator();
+    assertEquals(document, iterator.next().getCoveredText());
+    
+    
+    if (cas != null) {
+      cas.release();
+    }
+
+  }
+}

Propchange: uima/sandbox/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/GreedyAnchoringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/TestEngine.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/TestEngine.xml?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/TestEngine.xml (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/test/resources/org/apache/uima/ruta/TestEngine.xml Mon Oct 28 17:02:40 2013
@@ -138,6 +138,13 @@
         <mandatory>false</mandatory>
       </configurationParameter>
       <configurationParameter>
+        <name>greedyAnchoring</name>
+        <description>Activates greedy anchoring.</description>
+        <type>Boolean</type>
+        <multiValued>false</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+      <configurationParameter>
         <name>lowMemoryProfile</name>
         <type>Boolean</type>
         <multiValued>false</multiValued>

Modified: uima/sandbox/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.actions.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.actions.xml?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.actions.xml (original)
+++ uima/sandbox/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.actions.xml Mon Oct 28 17:02:40 2013
@@ -660,6 +660,36 @@ A B{-> GATHER(C, 1, 2, "a" = 1, "b" = 2)
     </section>
   </section>
 
+  <section id="ugr.tools.ruta.language.actions.greedyanchoring">
+    <title>GREEDYANCHORING</title>
+    <para>
+      The GREEDYANCHORING action turns greedy anchoring on or off
+      (first parameter). If this parameter is set to true, then start positions already matched by the same rule will be ignored. This situation 
+      occurs mostly for rules that start with a quantifier. 
+    </para>
+    <section>
+      <title>
+        <emphasis role="bold">Definition:</emphasis>
+      </title>
+      <para>
+        <programlisting><![CDATA[GREEDYANCHORING(BooleanExpression)]]></programlisting>
+      </para>
+    </section>
+    <section>
+      <title>
+        <emphasis role="bold">Example:</emphasis>
+      </title>
+      <para>
+        <programlisting><![CDATA[Document{->GREEDYANCHORING(true)};
+        ANY+;]]></programlisting>
+      </para>
+      <para>
+        The above mentioned example activates dynamic anchoring and the second rule will then only match once 
+        since the next positions, e.g., the second token, are already covered by the first attempt.
+      </para>
+    </section>
+  </section>
+
   <section id="ugr.tools.ruta.language.actions.log">
     <title>LOG</title>
     <para>

Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.g
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.g?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.g (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.g Mon Oct 28 17:02:40 2013
@@ -252,6 +252,10 @@ DYNAMICANCHORING 	
 	:	'DYNAMICANCHORING'	 
 	;
 
+GREEDYANCHORING   
+  : 'GREEDYANCHORING'  
+  ;
+
 TRIM
   : 'TRIM'
   ;

Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.tokens
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.tokens?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.tokens (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaLexer.tokens Mon Oct 28 17:02:40 2013
@@ -1,157 +1,159 @@
-STAR=143
-FloatTypeSuffix=119
-OctalLiteral=117
+STAR=145
+FloatTypeSuffix=121
+OctalLiteral=119
 LOG=37
 CONTAINS=8
-REMOVE=70
-GREATEREQUAL=156
+REMOVE=71
+GREATEREQUAL=158
 MARKFAST=41
-CONDITION=96
-MATCHEDTEXT=76
+CONDITION=98
+MATCHEDTEXT=77
 COUNT=14
-LOGN=105
-DYNAMICANCHORING=57
-NOT=68
-Identifier=129
-ACTION=97
-NOTEQUAL=153
-CLEAR=78
-VBAR=145
-DOUBLELIST=100
-ENDSWITH=63
-RPAREN=131
+LOGN=107
+DYNAMICANCHORING=58
+NOT=69
+Identifier=131
+ACTION=99
+NOTEQUAL=155
+CLEAR=79
+VBAR=147
+DOUBLELIST=102
+ENDSWITH=64
+RPAREN=133
 CREATE=31
-GREATER=148
-SIN=106
-EXP=104
+GREATER=150
+SIN=108
+EXP=106
 CURRENTCOUNT=16
-COS=107
-TAN=108
-TYPELIST=103
-FloatString=91
-LESS=147
+COS=109
+TAN=110
+TYPELIST=105
+FloatString=93
+LESS=149
 REGEXP=25
-GET=73
+GET=74
 PARTOF=22
-UNMARK=53
+UNMARK=54
 LAST=18
-COMMENT=159
-REMOVEDUPLICATE=71
-UNMARKALL=54
-RBRACK=133
+COMMENT=161
+REMOVEDUPLICATE=72
+UNMARKALL=55
+RBRACK=135
 NEAR=20
-LINE_COMMENT=160
-IntegerTypeSuffix=114
+LINE_COMMENT=162
+IntegerTypeSuffix=116
 MARKSCORE=39
-REMOVESTRING=77
-TRANSFER=55
-LCURLY=134
+REMOVESTRING=78
+TRANSFER=56
+LCURLY=136
 TRIE=7
-FILTERTYPE=46
-STRINGLIST=102
+FILTERTYPE=47
+MARKFIRST=44
+STRINGLIST=104
 MARKONCE=40
-ScriptString=83
-EngineString=84
-WS=158
+ScriptString=85
+EngineString=86
+WS=160
 WORDTABLE=11
 WORDLIST=10
-AutomataBlockString=87
-FloatingPointLiteral=120
-STARTANCHOR=112
-INTLIST=99
+AutomataBlockString=89
+FloatingPointLiteral=122
+STARTANCHOR=114
+INTLIST=101
 OR=21
-TRIM=58
-JavaIDDigit=128
-FLOATLIST=101
-CALL=47
+TRIM=59
+JavaIDDigit=130
+FLOATLIST=103
+CALL=48
 Annotation=5
-FALSE=111
-LESSEQUAL=155
-RessourceLiteral=124
+FALSE=113
+LESSEQUAL=157
+RessourceLiteral=126
 VOTE=27
-Letter=127
-EscapeSequence=121
-SIZE=75
-REMOVEFILTERTYPE=67
-LBRACK=132
-CharacterLiteral=122
+Letter=129
+EscapeSequence=123
+SIZE=76
+REMOVEFILTERTYPE=68
+LBRACK=134
+CharacterLiteral=124
 DEL=36
 ATTRIBUTE=34
-TypeString=88
-SHIFT=56
-Exponent=118
-ASSIGN_EQUAL=149
-RETAINTYPE=45
-TypeSystemString=94
+TypeString=90
+SHIFT=57
+Exponent=120
+THEN2=81
+ASSIGN_EQUAL=151
+RETAINTYPE=46
+TypeSystemString=96
 AND=12
-ADDFILTERTYPE=66
-BlockString=86
-IntString=89
-HexDigit=113
+ADDFILTERTYPE=67
+BlockString=88
+IntString=91
+HexDigit=115
 COLOR=35
-LPAREN=130
+LPAREN=132
 POSITION=24
 IF=28
-LogLevel=80
-CONFIGURE=49
-SLASH=144
-THEN=79
+LogLevel=82
+CONFIGURE=50
+SLASH=146
+THEN=80
 FILL=33
-COMMA=139
-IS=61
-AMPER=146
-REPLACE=44
-GETLIST=74
-WILDCARD=157
-EQUAL=152
+COMMA=141
+IS=62
+AMPER=148
+REPLACE=45
+GETLIST=75
+WILDCARD=159
+EQUAL=154
 GATHER=32
 INLIST=17
-PLUS=141
-BooleanString=93
-GETFEATURE=52
-DOT=137
+PLUS=143
+BooleanString=95
+GETFEATURE=53
+DOT=139
 ListIdentifier=6
 PARTOFNEQ=23
-BOOLEANLIST=98
-ADD=69
+BOOLEANLIST=100
+ADD=70
 MARKTABLE=42
-HexLiteral=115
-XOR=109
-PERCENT=150
+HexLiteral=117
+XOR=111
+PERCENT=152
 MARK=38
 PARSE=30
-PackageString=82
-OldColor=81
+PackageString=84
+OldColor=83
 MARKLAST=43
-MERGE=72
+MERGE=73
 CONTEXTCOUNT=13
-BEFORE=59
-EXEC=48
-MINUS=142
-AFTER=60
-DecimalLiteral=116
-SEMI=140
-TRUE=110
+BEFORE=60
+EXEC=49
+MINUS=144
+AFTER=61
+DecimalLiteral=118
+SEMI=142
+TRUE=112
 FEATURE=29
-SymbolString=95
-COLON=138
-StringLiteral=123
-StringString=92
+SymbolString=97
+COLON=140
+StringLiteral=125
+StringString=94
 SCORE=26
-QUESTION=151
-ADDRETAINTYPE=64
-UnicodeEscape=125
-RCURLY=135
-STARTSWITH=62
-ASSIGN=50
-REMOVERETAINTYPE=65
+QUESTION=153
+ADDRETAINTYPE=65
+UnicodeEscape=127
+RCURLY=137
+STARTSWITH=63
+ASSIGN=51
+REMOVERETAINTYPE=66
 TOTALCOUNT=15
 DECLARE=9
-UimafitString=85
+UimafitString=87
 DocComment=4
 MOFN=19
-OctalEscape=126
-SETFEATURE=51
-DoubleString=90
-CIRCUMFLEX=136
-ALT_NOTEQUAL=154
+OctalEscape=128
+SETFEATURE=52
+DoubleString=92
+CIRCUMFLEX=138
+ALT_NOTEQUAL=156

Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g Mon Oct 28 17:02:40 2013
@@ -1323,6 +1323,7 @@ result = ActionFactory.createEmptyAction
 	| a = actionShift
 	| a = actionConfigure
 	| a = actionDynamicAnchoring
+	| a = actionGreedyAnchoring
 	| a = actionTrim
 	| a = actionAddFilterType
 	| a = actionAddRetainType
@@ -1755,6 +1756,13 @@ actionDynamicAnchoring returns [RutaActi
     RPAREN
     ;
 
+actionGreedyAnchoring returns [RutaAction action = null]
+    :
+    name = GREEDYANCHORING LPAREN active = booleanExpression 
+     {action = ActionFactory.createAction(name, active);}
+    RPAREN
+    ;
+
 actionTrim returns [RutaAction action = null]
 @init {
 List<Expression> list = new ArrayList<Expression>();

Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.tokens
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.tokens?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.tokens (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.tokens Mon Oct 28 17:02:40 2013
@@ -1,157 +1,159 @@
-STAR=143
-FloatTypeSuffix=119
-OctalLiteral=117
+STAR=145
+FloatTypeSuffix=121
+OctalLiteral=119
 LOG=37
 CONTAINS=8
-REMOVE=70
-GREATEREQUAL=156
+REMOVE=71
+GREATEREQUAL=158
 MARKFAST=41
-CONDITION=96
-MATCHEDTEXT=76
+CONDITION=98
+MATCHEDTEXT=77
 COUNT=14
-LOGN=105
-DYNAMICANCHORING=57
-NOT=68
-Identifier=129
-ACTION=97
-CLEAR=78
-NOTEQUAL=153
-ENDSWITH=63
-DOUBLELIST=100
-VBAR=145
-RPAREN=131
+LOGN=107
+DYNAMICANCHORING=58
+NOT=69
+Identifier=131
+ACTION=99
+CLEAR=79
+NOTEQUAL=155
+ENDSWITH=64
+DOUBLELIST=102
+VBAR=147
+RPAREN=133
 CREATE=31
-GREATER=148
-SIN=106
-EXP=104
+GREATER=150
+SIN=108
+EXP=106
 CURRENTCOUNT=16
-COS=107
-TAN=108
-TYPELIST=103
-FloatString=91
-LESS=147
+COS=109
+TAN=110
+TYPELIST=105
+FloatString=93
+LESS=149
 REGEXP=25
-GET=73
-UNMARK=53
+GET=74
+UNMARK=54
 PARTOF=22
 LAST=18
-COMMENT=159
-REMOVEDUPLICATE=71
-UNMARKALL=54
-RBRACK=133
+COMMENT=161
+REMOVEDUPLICATE=72
+UNMARKALL=55
+RBRACK=135
 NEAR=20
-LINE_COMMENT=160
-IntegerTypeSuffix=114
+LINE_COMMENT=162
+IntegerTypeSuffix=116
 MARKSCORE=39
-REMOVESTRING=77
-TRANSFER=55
-LCURLY=134
+REMOVESTRING=78
+TRANSFER=56
+LCURLY=136
 TRIE=7
-FILTERTYPE=46
-STRINGLIST=102
+FILTERTYPE=47
+MARKFIRST=44
+STRINGLIST=104
 MARKONCE=40
-ScriptString=83
-EngineString=84
-WS=158
+ScriptString=85
+EngineString=86
+WS=160
 WORDTABLE=11
 WORDLIST=10
-AutomataBlockString=87
-FloatingPointLiteral=120
-STARTANCHOR=112
-INTLIST=99
+AutomataBlockString=89
+FloatingPointLiteral=122
+STARTANCHOR=114
+INTLIST=101
 OR=21
-TRIM=58
-JavaIDDigit=128
-FLOATLIST=101
-CALL=47
+TRIM=59
+JavaIDDigit=130
+FLOATLIST=103
+CALL=48
 Annotation=5
-FALSE=111
-LESSEQUAL=155
-RessourceLiteral=124
+FALSE=113
+LESSEQUAL=157
+RessourceLiteral=126
 VOTE=27
-Letter=127
-EscapeSequence=121
-SIZE=75
-REMOVEFILTERTYPE=67
-LBRACK=132
-CharacterLiteral=122
+Letter=129
+EscapeSequence=123
+SIZE=76
+REMOVEFILTERTYPE=68
+LBRACK=134
+CharacterLiteral=124
 DEL=36
 ATTRIBUTE=34
-TypeString=88
-SHIFT=56
-Exponent=118
-ASSIGN_EQUAL=149
-RETAINTYPE=45
-TypeSystemString=94
+TypeString=90
+SHIFT=57
+Exponent=120
+THEN2=81
+ASSIGN_EQUAL=151
+RETAINTYPE=46
+TypeSystemString=96
 AND=12
-IntString=89
-ADDFILTERTYPE=66
-BlockString=86
-HexDigit=113
+IntString=91
+BlockString=88
+ADDFILTERTYPE=67
+HexDigit=115
 COLOR=35
 POSITION=24
-LPAREN=130
+LPAREN=132
 IF=28
-LogLevel=80
-CONFIGURE=49
-SLASH=144
-THEN=79
+LogLevel=82
+CONFIGURE=50
+SLASH=146
+THEN=80
 FILL=33
-COMMA=139
-IS=61
-GETLIST=74
-REPLACE=44
-AMPER=146
-WILDCARD=157
-EQUAL=152
+COMMA=141
+IS=62
+GETLIST=75
+REPLACE=45
+AMPER=148
+WILDCARD=159
+EQUAL=154
 GATHER=32
 INLIST=17
-PLUS=141
-BooleanString=93
-GETFEATURE=52
-DOT=137
+PLUS=143
+BooleanString=95
+GETFEATURE=53
+DOT=139
 ListIdentifier=6
 PARTOFNEQ=23
-ADD=69
-BOOLEANLIST=98
+ADD=70
+BOOLEANLIST=100
 MARKTABLE=42
-HexLiteral=115
-XOR=109
+HexLiteral=117
+XOR=111
 MARK=38
-PERCENT=150
-PackageString=82
+PERCENT=152
+PackageString=84
 PARSE=30
-OldColor=81
-MERGE=72
+OldColor=83
+MERGE=73
 MARKLAST=43
 CONTEXTCOUNT=13
-BEFORE=59
-EXEC=48
-AFTER=60
-MINUS=142
-DecimalLiteral=116
-TRUE=110
-SEMI=140
+BEFORE=60
+EXEC=49
+AFTER=61
+MINUS=144
+DecimalLiteral=118
+TRUE=112
+SEMI=142
 FEATURE=29
-SymbolString=95
-StringString=92
-StringLiteral=123
-COLON=138
+SymbolString=97
+StringString=94
+StringLiteral=125
+COLON=140
 SCORE=26
-QUESTION=151
-ADDRETAINTYPE=64
-UnicodeEscape=125
-STARTSWITH=62
-RCURLY=135
-ASSIGN=50
-REMOVERETAINTYPE=65
+QUESTION=153
+ADDRETAINTYPE=65
+UnicodeEscape=127
+STARTSWITH=63
+RCURLY=137
+ASSIGN=51
+REMOVERETAINTYPE=66
 TOTALCOUNT=15
-UimafitString=85
+UimafitString=87
 DECLARE=9
 DocComment=4
 MOFN=19
-SETFEATURE=51
-OctalEscape=126
-DoubleString=90
-CIRCUMFLEX=136
-ALT_NOTEQUAL=154
+SETFEATURE=52
+OctalEscape=128
+DoubleString=92
+CIRCUMFLEX=138
+ALT_NOTEQUAL=156

Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/RutaKeywords.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/RutaKeywords.java?rev=1536410&r1=1536409&r2=1536410&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/RutaKeywords.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/RutaKeywords.java Mon Oct 28 17:02:40 2013
@@ -36,7 +36,7 @@ public class RutaKeywords implements IRu
       "FILTERTYPE", "CREATE", "FILL", "MARKTABLE", "UNMARK", "TRANSFER", "MARKONCE", "TRIE",
       "GATHER", "EXEC", "MARKLAST", "ADD", "REMOVE", "MERGE", "GET", "GETLIST", "REMOVEDUPLICATE",
       "GETFEATURE", "MATCHEDTEXT", "CLEAR", "UNMARKALL", "SHIFT", "CONFIGURE", "DYNAMICANCHORING",
-      "TRIM", "ADDRETAINTYPE", "REMOVERETAINTYPE", "ADDFILTERTYPE", "REMOVEFILTERTYPE", "MARKFIRST" };
+      "TRIM", "ADDRETAINTYPE", "REMOVERETAINTYPE", "ADDFILTERTYPE", "REMOVEFILTERTYPE", "MARKFIRST", "GREEDYANCHORING" };
 
   private static String[] basic = { "ALL", "ANY", "AMP", "BREAK", "W", "NUM", "PM", "Document",
       "MARKUP", "SW", "CW", "CAP", "PERIOD", "NBSP", "SENTENCEEND", "COLON", "COMMA", "SEMICOLON",