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/03/21 14:44:06 UTC
svn commit: r1459309 [1/2] - in /uima/sandbox/textmarker/trunk:
textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/
textmarker-core/src/main/java/org/apache/uima/textmarker/
textmarker-core/src/main/java/org/apache/uima/textmarker/action...
Author: pkluegl
Date: Thu Mar 21 13:44:04 2013
New Revision: 1459309
URL: http://svn.apache.org/r1459309
Log:
UIMA-2756
- added new rule type for regexp matching
- added test
- added documentation
- fixed explanation for new rule type
- some refactoring and organized imports
Added:
uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens
uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.tokens
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRule.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRuleMatch.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRule.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRuleMatch.java
uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/RegExpRuleTest.java
uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.tm
uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.txt
Modified:
uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.g
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerAutomataBlock.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerBlock.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerModule.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptBlock.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptFactory.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStatement.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/AbstractMarkAction.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/MarkFastAction.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/TrimAction.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/PlainTextAnnotator.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleApply.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleMatch.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRule.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/DefaultSeeder.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ActionVerbalizer.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ConditionVerbalizer.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/CreatedByVisitor.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoCollectorVisitor.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoFactory.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/InferenceCrowd.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/StatisticsVisitor.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TextMarkerInferenceVisitor.java
uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TimeProfilerVisitor.java
uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/AllTests.java
uima/sandbox/textmarker/trunk/textmarker-docbook/src/docbook/tools.textmarker.language.syntax.xml
uima/sandbox/textmarker/trunk/textmarker-docbook/src/docbook/tools.textmarker.language.xml
uima/sandbox/textmarker/trunk/textmarker-docbook/src/docbook/tools.textmarker.overview.xml
uima/sandbox/textmarker/trunk/textmarker-ep-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainTree.java
uima/sandbox/textmarker/trunk/textmarker-ep-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchNode.java
uima/sandbox/textmarker/trunk/textmarker-ep-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.g
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens Thu Mar 21 13:44:04 2013
@@ -0,0 +1,155 @@
+STAR=142
+FloatTypeSuffix=117
+OctalLiteral=115
+LOG=37
+CONTAINS=8
+REMOVE=70
+GREATEREQUAL=155
+MARKFAST=41
+CONDITION=95
+MATCHEDTEXT=76
+COUNT=14
+LOGN=104
+DYNAMICANCHORING=57
+NOT=68
+Identifier=127
+ACTION=96
+NOTEQUAL=152
+CLEAR=78
+VBAR=144
+DOUBLELIST=99
+ENDSWITH=63
+RPAREN=129
+CREATE=31
+GREATER=147
+SIN=105
+EXP=103
+CURRENTCOUNT=16
+COS=106
+TAN=107
+TYPELIST=102
+FloatString=90
+LESS=146
+REGEXP=25
+GET=73
+PARTOF=22
+UNMARK=53
+LAST=18
+COMMENT=157
+REMOVEDUPLICATE=71
+UNMARKALL=54
+RBRACK=131
+NEAR=20
+LINE_COMMENT=158
+IntegerTypeSuffix=112
+MARKSCORE=39
+REMOVESTRING=77
+TRANSFER=55
+LCURLY=132
+TRIE=7
+FILTERTYPE=46
+STRINGLIST=101
+MARKONCE=40
+ScriptString=83
+EngineString=84
+WS=156
+WORDTABLE=11
+WORDLIST=10
+AutomataBlockString=86
+FloatingPointLiteral=118
+INTLIST=98
+OR=21
+TRIM=58
+JavaIDDigit=126
+FLOATLIST=100
+CALL=47
+Annotation=5
+FALSE=110
+LESSEQUAL=154
+RessourceLiteral=122
+VOTE=27
+Letter=125
+EscapeSequence=119
+SIZE=75
+REMOVEFILTERTYPE=67
+LBRACK=130
+CharacterLiteral=120
+DEL=36
+ATTRIBUTE=34
+TypeString=87
+SHIFT=56
+Exponent=116
+ASSIGN_EQUAL=148
+RETAINTYPE=45
+TypeSystemString=93
+AND=12
+ADDFILTERTYPE=66
+BlockString=85
+IntString=88
+HexDigit=111
+COLOR=35
+LPAREN=128
+POSITION=24
+IF=28
+AT=135
+LogLevel=80
+CONFIGURE=49
+SLASH=143
+THEN=79
+FILL=33
+COMMA=138
+IS=61
+AMPER=145
+REPLACE=44
+GETLIST=74
+EQUAL=151
+GATHER=32
+INLIST=17
+PLUS=140
+BooleanString=92
+GETFEATURE=52
+DOT=136
+ListIdentifier=6
+PARTOFNEQ=23
+BOOLEANLIST=97
+ADD=69
+MARKTABLE=42
+HexLiteral=113
+XOR=108
+PERCENT=149
+MARK=38
+PARSE=30
+PackageString=82
+OldColor=81
+MARKLAST=43
+MERGE=72
+CONTEXTCOUNT=13
+BEFORE=59
+EXEC=48
+MINUS=141
+AFTER=60
+DecimalLiteral=114
+SEMI=139
+TRUE=109
+FEATURE=29
+SymbolString=94
+COLON=137
+StringLiteral=121
+StringString=91
+SCORE=26
+QUESTION=150
+ADDRETAINTYPE=64
+UnicodeEscape=123
+RCURLY=133
+STARTSWITH=62
+ASSIGN=50
+REMOVERETAINTYPE=65
+TOTALCOUNT=15
+DECLARE=9
+DocComment=4
+MOFN=19
+OctalEscape=124
+SETFEATURE=51
+DoubleString=89
+CIRCUMFLEX=134
+ALT_NOTEQUAL=153
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.g
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.g?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.g (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.g Thu Mar 21 13:44:04 2013
@@ -76,6 +76,7 @@ import org.apache.uima.textmarker.expres
import org.apache.uima.textmarker.expression.type.TypeExpression;
import org.apache.uima.textmarker.extensions.TextMarkerExternalFactory;
import org.apache.uima.textmarker.rule.ComposedRuleElement;
+import org.apache.uima.textmarker.rule.RegExpRule;
import org.apache.uima.textmarker.rule.RuleElement;
import org.apache.uima.textmarker.rule.RuleElementContainer;
import org.apache.uima.textmarker.rule.RuleElementIsolator;
@@ -287,7 +288,7 @@ List<String> vars = new ArrayList<String
{!ownsVariable($blockDeclaration::env, input.LT(1).getText())}? id = Identifier {vars.add(id.getText());addVariable($blockDeclaration::env, id.getText(), type.getText());}
(COMMA {!ownsVariable($blockDeclaration::env, input.LT(1).getText())}? id = Identifier {vars.add(id.getText());addVariable($blockDeclaration::env, id.getText(), type.getText());}
)* (ASSIGN_EQUAL value5 = typeExpression)? {setValue($blockDeclaration::env, vars, value5);} SEMI
- |
+ |
type = WORDLIST
{!isVariableOfType($blockDeclaration::env, input.LT(1).getText(), type.getText())}?
name = Identifier (ASSIGN_EQUAL list = wordListExpression)? SEMI {addVariable($blockDeclaration::env, name.getText(), type.getText());if(list != null){setValue($blockDeclaration::env, name.getText(), list);}}
@@ -498,12 +499,61 @@ ruleElementWithCA[RuleElementContainer c
-simpleStatement returns [TextMarkerRule stmt = null]
+simpleStatement returns [TextMarkerStatement stmt = null]
+options {
+ backtrack = true;
+}
+@init{
+ //RegExpRule rer = null;
+ Map<TypeExpression, TextMarkerExpression> map = new HashMap<TypeExpression, TextMarkerExpression>();
+}
:
+
+ (regexpRule)=> rer = regexpRule {stmt = rer;}
+ {stmt = rer;}
+
+ |
+
{stmt = factory.createRule(elements, $blockDeclaration::env);}
- elements = ruleElements[stmt.getRoot()] SEMI
- {stmt.setRuleElements(elements);}
+ elements = ruleElements[((TextMarkerRule)stmt).getRoot()] SEMI
+ {((TextMarkerRule)stmt).setRuleElements(elements);}
;
+
+
+
+
+regexpRule returns [RegExpRule stmt = null]
+@init{
+ Map<TypeExpression, NumberExpression> map = new HashMap<TypeExpression, NumberExpression>();
+}
+ :
+ {
+ stmt = factory.createRegExpRule($blockDeclaration::env);}
+
+ regexp = stringExpression THEN
+ (
+ (numberExpression ASSIGN_EQUAL)=> indexCG = numberExpression ASSIGN_EQUAL indexTE = typeExpression {map.put(indexTE, indexCG);}
+ |
+ te = typeExpression {map.put(te, null);}
+ )
+ (
+ COMMA
+ (
+ (numberExpression ASSIGN_EQUAL)=> indexCG = numberExpression ASSIGN_EQUAL indexTE = typeExpression {map.put(indexTE, indexCG);}
+ |
+ te = typeExpression {map.put(te, null);}
+ )
+
+ )*
+
+ SEMI
+ {stmt.setRegExp(regexp);
+ stmt.setTypeMap(map);
+ }
+
+ ;
+
+
ruleElements[RuleElementContainer container] returns [List<RuleElement> elements = new ArrayList<RuleElement>()]
:
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.tokens
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.tokens?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.tokens (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.tokens Thu Mar 21 13:44:04 2013
@@ -0,0 +1,155 @@
+STAR=142
+FloatTypeSuffix=117
+OctalLiteral=115
+LOG=37
+CONTAINS=8
+REMOVE=70
+GREATEREQUAL=155
+MARKFAST=41
+CONDITION=95
+MATCHEDTEXT=76
+COUNT=14
+LOGN=104
+DYNAMICANCHORING=57
+NOT=68
+Identifier=127
+ACTION=96
+CLEAR=78
+NOTEQUAL=152
+ENDSWITH=63
+DOUBLELIST=99
+VBAR=144
+RPAREN=129
+CREATE=31
+GREATER=147
+SIN=105
+EXP=103
+CURRENTCOUNT=16
+COS=106
+TAN=107
+TYPELIST=102
+FloatString=90
+LESS=146
+REGEXP=25
+GET=73
+UNMARK=53
+PARTOF=22
+LAST=18
+COMMENT=157
+REMOVEDUPLICATE=71
+UNMARKALL=54
+RBRACK=131
+NEAR=20
+LINE_COMMENT=158
+IntegerTypeSuffix=112
+MARKSCORE=39
+REMOVESTRING=77
+TRANSFER=55
+LCURLY=132
+TRIE=7
+FILTERTYPE=46
+STRINGLIST=101
+MARKONCE=40
+ScriptString=83
+EngineString=84
+WS=156
+WORDTABLE=11
+WORDLIST=10
+AutomataBlockString=86
+FloatingPointLiteral=118
+INTLIST=98
+OR=21
+TRIM=58
+JavaIDDigit=126
+FLOATLIST=100
+CALL=47
+Annotation=5
+FALSE=110
+LESSEQUAL=154
+RessourceLiteral=122
+VOTE=27
+Letter=125
+EscapeSequence=119
+SIZE=75
+REMOVEFILTERTYPE=67
+LBRACK=130
+CharacterLiteral=120
+DEL=36
+ATTRIBUTE=34
+TypeString=87
+SHIFT=56
+Exponent=116
+ASSIGN_EQUAL=148
+RETAINTYPE=45
+TypeSystemString=93
+AND=12
+ADDFILTERTYPE=66
+BlockString=85
+IntString=88
+HexDigit=111
+COLOR=35
+POSITION=24
+LPAREN=128
+IF=28
+AT=135
+LogLevel=80
+CONFIGURE=49
+SLASH=143
+THEN=79
+FILL=33
+COMMA=138
+IS=61
+GETLIST=74
+REPLACE=44
+AMPER=145
+EQUAL=151
+GATHER=32
+INLIST=17
+PLUS=140
+BooleanString=92
+GETFEATURE=52
+DOT=136
+ListIdentifier=6
+PARTOFNEQ=23
+ADD=69
+BOOLEANLIST=97
+MARKTABLE=42
+HexLiteral=113
+XOR=108
+MARK=38
+PERCENT=149
+PackageString=82
+PARSE=30
+OldColor=81
+MERGE=72
+MARKLAST=43
+CONTEXTCOUNT=13
+BEFORE=59
+EXEC=48
+AFTER=60
+MINUS=141
+DecimalLiteral=114
+TRUE=109
+SEMI=139
+FEATURE=29
+SymbolString=94
+StringString=91
+StringLiteral=121
+COLON=137
+SCORE=26
+QUESTION=150
+ADDRETAINTYPE=64
+UnicodeEscape=123
+STARTSWITH=62
+RCURLY=133
+ASSIGN=50
+REMOVERETAINTYPE=65
+TOTALCOUNT=15
+DECLARE=9
+DocComment=4
+MOFN=19
+SETFEATURE=51
+OctalEscape=124
+DoubleString=89
+CIRCUMFLEX=134
+ALT_NOTEQUAL=153
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerAutomataBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerAutomataBlock.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerAutomataBlock.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerAutomataBlock.java Thu Mar 21 13:44:04 2013
@@ -23,6 +23,8 @@ import java.util.List;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
import org.apache.uima.textmarker.rule.RuleApply;
import org.apache.uima.textmarker.rule.RuleMatch;
import org.apache.uima.textmarker.rule.TextMarkerRule;
@@ -41,9 +43,10 @@ public class TextMarkerAutomataBlock ext
BlockApply result = new BlockApply(this);
crowd.beginVisit(this, result);
RuleApply apply = rule.apply(stream, crowd, true);
- for (RuleMatch eachMatch : apply.getList()) {
+ for (AbstractRuleMatch<? extends AbstractRule> eachMatch : apply.getList()) {
if (eachMatch.matched()) {
- AnnotationFS each = eachMatch.getMatchedAnnotations(stream, null, null).get(0);
+ AnnotationFS each = ((RuleMatch) eachMatch).getMatchedAnnotations(stream, null, null)
+ .get(0);
if (each == null) {
continue;
}
@@ -66,7 +69,7 @@ public class TextMarkerAutomataBlock ext
@Override
public String toString() {
String ruleString = rule == null ? "Document" : rule.toString();
- return "RULES(" + id + ") " + ruleString + " containing " + elements.size() + " Elements";
+ return "RULES(" + name + ") " + ruleString + " containing " + elements.size() + " Elements";
}
public void setMatchRule(TextMarkerRule rule) {
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerBlock.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerBlock.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerBlock.java Thu Mar 21 13:44:04 2013
@@ -25,7 +25,7 @@ import org.apache.uima.textmarker.rule.T
public abstract class TextMarkerBlock extends TextMarkerStatement {
- protected final String id;
+ protected final String name;
protected TextMarkerEnvironment environment;
@@ -37,10 +37,10 @@ public abstract class TextMarkerBlock ex
private TextMarkerModule script;
- public TextMarkerBlock(String id, TextMarkerRule rule, List<TextMarkerStatement> elements,
+ public TextMarkerBlock(String name, TextMarkerRule rule, List<TextMarkerStatement> elements,
TextMarkerBlock parent, String defaultNamespace) {
super(parent);
- this.id = id;
+ this.name = name;
this.rule = rule;
this.elements = elements;
this.environment = new TextMarkerEnvironment(this);
@@ -89,8 +89,8 @@ public abstract class TextMarkerBlock ex
return namespace;
}
- public String getId() {
- return id;
+ public String getName() {
+ return name;
}
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerModule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerModule.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerModule.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerModule.java Thu Mar 21 13:44:04 2013
@@ -51,14 +51,14 @@ public class TextMarkerModule extends Te
}
public TextMarkerBlock getBlock(String id) {
- if (id == null || id.equals(rootBlock.getId())) {
+ if (id == null || id.equals(rootBlock.getName())) {
return rootBlock;
}
return blocks.get(id);
}
public TextMarkerModule getScript(String name) {
- if (name.equals(rootBlock.getId())) {
+ if (name.equals(rootBlock.getName())) {
return this;
}
TextMarkerModule result = scripts.get(name);
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptBlock.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptBlock.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptBlock.java Thu Mar 21 13:44:04 2013
@@ -23,6 +23,8 @@ import java.util.List;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
import org.apache.uima.textmarker.rule.RuleApply;
import org.apache.uima.textmarker.rule.RuleMatch;
import org.apache.uima.textmarker.rule.TextMarkerRule;
@@ -41,9 +43,10 @@ public class TextMarkerScriptBlock exten
BlockApply result = new BlockApply(this);
crowd.beginVisit(this, result);
RuleApply apply = rule.apply(stream, crowd, true);
- for (RuleMatch eachMatch : apply.getList()) {
+ for (AbstractRuleMatch<? extends AbstractRule> eachMatch : apply.getList()) {
if (eachMatch.matched()) {
- List<AnnotationFS> matchedAnnotations = eachMatch.getMatchedAnnotations(stream, null, null);
+ List<AnnotationFS> matchedAnnotations = ((RuleMatch) eachMatch).getMatchedAnnotations(
+ stream, null, null);
if (matchedAnnotations == null || matchedAnnotations.isEmpty()) {
continue;
}
@@ -70,7 +73,7 @@ public class TextMarkerScriptBlock exten
@Override
public String toString() {
String ruleString = rule == null ? "Document" : rule.toString();
- return "BLOCK(" + id + ") " + ruleString + " containing " + elements.size() + " Elements";
+ return "BLOCK(" + name + ") " + ruleString + " containing " + elements.size() + " Elements";
}
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptFactory.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptFactory.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerScriptFactory.java Thu Mar 21 13:44:04 2013
@@ -32,6 +32,7 @@ import org.apache.uima.textmarker.expres
import org.apache.uima.textmarker.expression.type.SimpleTypeExpression;
import org.apache.uima.textmarker.expression.type.TypeExpression;
import org.apache.uima.textmarker.rule.ComposedRuleElement;
+import org.apache.uima.textmarker.rule.RegExpRule;
import org.apache.uima.textmarker.rule.RuleElement;
import org.apache.uima.textmarker.rule.RuleElementContainer;
import org.apache.uima.textmarker.rule.RuleElementIsolator;
@@ -187,4 +188,8 @@ public class TextMarkerScriptFactory {
return createScriptBlock(id, re, body, env);
}
+ public RegExpRule createRegExpRule(TextMarkerBlock env) {
+ return new RegExpRule(null, null, idCounter++, env);
+ }
+
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStatement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStatement.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStatement.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStatement.java Thu Mar 21 13:44:04 2013
@@ -42,4 +42,6 @@ public abstract class TextMarkerStatemen
this.parent = parent;
}
+
+
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java Thu Mar 21 13:44:04 2013
@@ -25,7 +25,6 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
-import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
@@ -42,7 +41,8 @@ import org.apache.uima.cas.text.Annotati
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.tcas.Annotation;
import org.apache.uima.jcas.tcas.DocumentAnnotation;
-import org.apache.uima.textmarker.rule.RuleMatch;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
import org.apache.uima.textmarker.type.TextMarkerAnnotation;
import org.apache.uima.textmarker.type.TextMarkerBasic;
import org.apache.uima.textmarker.visitor.InferenceCrowd;
@@ -187,18 +187,21 @@ public class TextMarkerStream extends FS
updateIterators(documentAnnotation);
}
- public void addAnnotation(AnnotationFS annotation, boolean addToIndex, RuleMatch creator) {
+ public void addAnnotation(AnnotationFS annotation, boolean addToIndex,
+ AbstractRuleMatch<? extends AbstractRule> creator) {
if (addToIndex) {
cas.addFsToIndexes(annotation);
}
addAnnotation(annotation, creator);
}
- public void addAnnotation(AnnotationFS annotation, RuleMatch creator) {
+ public void addAnnotation(AnnotationFS annotation,
+ AbstractRuleMatch<? extends AbstractRule> creator) {
addAnnotation(annotation, false, true, creator);
}
-
- public void addAnnotation(AnnotationFS annotation, boolean addToIndex, boolean updateInternal, RuleMatch creator) {
+
+ public void addAnnotation(AnnotationFS annotation, boolean addToIndex, boolean updateInternal,
+ AbstractRuleMatch<? extends AbstractRule> creator) {
Type type = annotation.getType();
boolean modified = checkSpan(annotation);
if (modified && updateInternal) {
@@ -214,6 +217,9 @@ public class TextMarkerStream extends FS
for (TextMarkerBasic basic : basicAnnotationsInWindow) {
basic.addPartOf(type);
}
+ if (addToIndex) {
+ cas.addFsToIndexes(annotation);
+ }
crowd.annotationAdded(annotation, creator);
}
@@ -244,6 +250,9 @@ public class TextMarkerStream extends FS
// TextMarkerBasic floor = floorEntry.getValue();
// TextMarkerBasic ceiling = ceilingEntry.getValue();
TextMarkerBasic floor = getFloor(endAnchors, anchor);
+ if(floor == null) {
+ floor = getFloor(beginAnchors, anchor);
+ }
TextMarkerBasic ceiling = getCeiling(endAnchors, anchor);
if (floor != null && ceiling != null) {
TextMarkerBasic toSplit = null;
@@ -266,8 +275,7 @@ public class TextMarkerStream extends FS
endAnchors.put(ceiling.getEnd(), ceiling);
return true;
} else {
- // TODO this should never happen! test it and remove the assert!
- assert (false);
+ // TODO this should never happen! test it!
}
return false;
}
@@ -607,7 +615,7 @@ public class TextMarkerStream extends FS
filter.filterTypes(list);
currentIt = filter.createFilteredIterator(cas, basicType);
}
-
+
public void addFilterTypes(List<Type> types) {
filter.addFilterTypes(types);
currentIt = filter.createFilteredIterator(cas, basicType);
@@ -627,7 +635,6 @@ public class TextMarkerStream extends FS
filter.removeRetainTypes(types);
currentIt = filter.createFilteredIterator(cas, basicType);
}
-
public FilterManager getFilter() {
return filter;
@@ -705,6 +712,4 @@ public class TextMarkerStream extends FS
this.simpleGreedyForComposed = simpleGreedyForComposed;
}
-
-
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/AbstractMarkAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/AbstractMarkAction.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/AbstractMarkAction.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/AbstractMarkAction.java Thu Mar 21 13:44:04 2013
@@ -30,7 +30,6 @@ import org.apache.uima.textmarker.expres
import org.apache.uima.textmarker.expression.type.TypeExpression;
import org.apache.uima.textmarker.rule.RuleElement;
import org.apache.uima.textmarker.rule.RuleMatch;
-import org.apache.uima.textmarker.type.TextMarkerBasic;
public abstract class AbstractMarkAction extends TypeSensitiveAction {
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/MarkFastAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/MarkFastAction.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/MarkFastAction.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/MarkFastAction.java Thu Mar 21 13:44:04 2013
@@ -35,7 +35,6 @@ import org.apache.uima.textmarker.resour
import org.apache.uima.textmarker.resource.TreeWordList;
import org.apache.uima.textmarker.rule.RuleElement;
import org.apache.uima.textmarker.rule.RuleMatch;
-import org.apache.uima.textmarker.type.TextMarkerBasic;
import org.apache.uima.textmarker.visitor.InferenceCrowd;
public class MarkFastAction extends AbstractMarkAction {
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/TrimAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/TrimAction.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/TrimAction.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/action/TrimAction.java Thu Mar 21 13:44:04 2013
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.tcas.Annotation;
-import org.apache.uima.textmarker.TextMarkerElement;
import org.apache.uima.textmarker.TextMarkerStatement;
import org.apache.uima.textmarker.TextMarkerStream;
import org.apache.uima.textmarker.expression.list.TypeListExpression;
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java Thu Mar 21 13:44:04 2013
@@ -20,7 +20,6 @@
package org.apache.uima.textmarker.engine;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/PlainTextAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/PlainTextAnnotator.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/PlainTextAnnotator.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/engine/PlainTextAnnotator.java Thu Mar 21 13:44:04 2013
@@ -20,24 +20,16 @@
package org.apache.uima.textmarker.engine;
import java.io.BufferedReader;
-import java.io.File;
import java.io.IOException;
import java.io.StringReader;
-import java.net.URL;
import org.apache.commons.lang3.StringUtils;
-import org.apache.uima.UIMAFramework;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
-import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceSpecifier;
-import org.apache.uima.util.FileUtils;
-import org.apache.uima.util.XMLInputSource;
public class PlainTextAnnotator extends JCasAnnotator_ImplBase {
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRule.java?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRule.java (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRule.java Thu Mar 21 13:44:04 2013
@@ -0,0 +1,40 @@
+/*
+ * 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.rule;
+
+import org.apache.uima.textmarker.TextMarkerBlock;
+import org.apache.uima.textmarker.TextMarkerStatement;
+
+public abstract class AbstractRule extends TextMarkerStatement {
+
+ private final int id;
+
+ public AbstractRule(TextMarkerBlock parent, int id) {
+ super(parent);
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+
+}
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRuleMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRuleMatch.java?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRuleMatch.java (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/AbstractRuleMatch.java Thu Mar 21 13:44:04 2013
@@ -0,0 +1,57 @@
+/*
+ * 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.rule;
+
+import java.util.List;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.TextMarkerStream;
+
+public abstract class AbstractRuleMatch<T extends AbstractRule> {
+
+ protected boolean matched = true;
+
+ protected final T rule;
+
+ public AbstractRuleMatch(T rule) {
+ super();
+ this.rule = rule;
+ }
+
+ public T getRule() {
+ return rule;
+ }
+
+ public boolean matched() {
+ return matched;
+ }
+
+ public boolean matchedCompletely() {
+ return true;
+ }
+
+// public abstract List<AnnotationFS> getMatchedAnnotations(TextMarkerStream stream,
+// List<Integer> indexes, RuleElementContainer container);
+
+ public abstract List<AnnotationFS> getMatchedAnnotationsOfRoot(TextMarkerStream stream);
+
+
+
+}
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRule.java?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRule.java (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRule.java Thu Mar 21 13:44:04 2013
@@ -0,0 +1,147 @@
+/*
+ * 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.rule;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.regex.MatchResult;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.ScriptApply;
+import org.apache.uima.textmarker.TextMarkerBlock;
+import org.apache.uima.textmarker.TextMarkerEnvironment;
+import org.apache.uima.textmarker.TextMarkerStream;
+import org.apache.uima.textmarker.expression.number.NumberExpression;
+import org.apache.uima.textmarker.expression.string.StringExpression;
+import org.apache.uima.textmarker.expression.type.TypeExpression;
+import org.apache.uima.textmarker.visitor.InferenceCrowd;
+
+public class RegExpRule extends AbstractRule {
+
+ private Map<TypeExpression, NumberExpression> typeMap;
+
+ private StringExpression regexpExpr;
+
+ public RegExpRule(StringExpression regexp, Map<TypeExpression, NumberExpression> typeMap, int id,
+ TextMarkerBlock parent) {
+ super(parent, id);
+ this.regexpExpr = regexp;
+ this.typeMap = typeMap;
+ }
+
+ @Override
+ public ScriptApply apply(TextMarkerStream stream, InferenceCrowd crowd) {
+ RuleApply ruleApply = new RuleApply(this, false);
+ crowd.beginVisit(this, ruleApply);
+
+ String regexpString = regexpExpr.getStringValue(getParent());
+ AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
+ String document = documentAnnotation.getCoveredText();
+ int delta = documentAnnotation.getBegin();
+
+ Map<Integer, List<Type>> groupTypes = getGroup2Types();
+
+ Pattern pattern = Pattern.compile(regexpString, Pattern.MULTILINE | Pattern.DOTALL);
+ Matcher matcher = pattern.matcher(document);
+ int groupCount = matcher.groupCount();
+ while (matcher.find()) {
+ RegExpRuleMatch ruleMatch = new RegExpRuleMatch(this);
+ MatchResult matchResult = matcher.toMatchResult();
+ for (int i = 0; i <= groupCount; i++) {
+ int begin = matchResult.start(i);
+ int end = matchResult.end(i);
+ List<Type> types = groupTypes.get(i);
+ if (types != null) {
+ createAnnotations(i, delta, begin, end, types, ruleMatch, stream);
+ } else if(i==0) {
+ CAS cas = stream.getCas();
+ AnnotationFS afs = cas.createAnnotation(cas.getAnnotationType(), delta + begin, delta + end);
+ ruleMatch.addMatched(0, afs);
+ }
+ }
+ if(!ruleMatch.getMatchedAnnotationsOfRoot(stream).isEmpty()) {
+ ruleApply.add(ruleMatch);
+ }
+ }
+
+ crowd.endVisit(this, ruleApply);
+ return ruleApply;
+ }
+
+ private Map<Integer, List<Type>> getGroup2Types() {
+ Map<Integer, List<Type>> groupTypes = new TreeMap<Integer, List<Type>>();
+
+ Set<Entry<TypeExpression, NumberExpression>> entrySet = typeMap.entrySet();
+ for (Entry<TypeExpression, NumberExpression> entry : entrySet) {
+ Type type = entry.getKey().getType(getParent());
+ NumberExpression value = entry.getValue();
+ int group = value == null ? 0 : value.getIntegerValue(getParent());
+ List<Type> list = groupTypes.get(group);
+ if (list == null) {
+ list = new ArrayList<Type>();
+ groupTypes.put(group, list);
+ }
+ list.add(type);
+ }
+ return groupTypes;
+ }
+
+ private void createAnnotations(int group, int delta, int begin, int end, List<Type> globalTypes, RegExpRuleMatch match, TextMarkerStream stream) {
+ CAS cas = stream.getCas();
+ if (begin < end) {
+ for (Type type : globalTypes) {
+ AnnotationFS afs = cas.createAnnotation(type, delta + begin, delta + end);
+ match.addMatched(group, afs);
+ stream.addAnnotation(afs, true, true, match);
+ }
+ }
+ }
+
+ @Override
+ public TextMarkerEnvironment getEnvironment() {
+ return getParent().getEnvironment();
+ }
+
+ public Map<TypeExpression, NumberExpression> getTypeMap() {
+ return typeMap;
+ }
+
+ public void setTypeMap(Map<TypeExpression, NumberExpression> typeMap) {
+ this.typeMap = typeMap;
+ }
+
+ public StringExpression getRegExp() {
+ return regexpExpr;
+ }
+
+ public void setRegExp(StringExpression regexpExpr) {
+ this.regexpExpr = regexpExpr;
+ }
+
+
+}
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRuleMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRuleMatch.java?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRuleMatch.java (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RegExpRuleMatch.java Thu Mar 21 13:44:04 2013
@@ -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.rule;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.TextMarkerStream;
+
+public class RegExpRuleMatch extends AbstractRuleMatch<RegExpRule> {
+
+ private Map<Integer, List<AnnotationFS>> map = new TreeMap<Integer, List<AnnotationFS>>();
+
+ public RegExpRuleMatch(RegExpRule rule) {
+ super(rule);
+ }
+
+ @Override
+ public List<AnnotationFS> getMatchedAnnotationsOfRoot(TextMarkerStream stream) {
+ return map.get(0);
+ }
+
+ public void addMatched(int group, AnnotationFS afs) {
+ List<AnnotationFS> list = map.get(group);
+ if (list == null) {
+ list = new LinkedList<AnnotationFS>();
+ map.put(group, list);
+ }
+ list.add(afs);
+ }
+
+ public Map<Integer, List<AnnotationFS>> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<Integer, List<AnnotationFS>> map) {
+ this.map = map;
+ }
+
+}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleApply.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleApply.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleApply.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleApply.java Thu Mar 21 13:44:04 2013
@@ -1,50 +1,32 @@
-/*
- * 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.rule;
import java.util.ArrayList;
import java.util.List;
import org.apache.uima.textmarker.ScriptApply;
+import org.apache.uima.textmarker.TextMarkerStatement;
public class RuleApply extends ScriptApply {
- private int tried = 0;
-
- private int applied = 0;
+ private List<AbstractRuleMatch<? extends AbstractRule>> list;
+
+ protected int tried = 0;
+ protected int applied = 0;
+
private boolean acceptMatches;
-
- private List<RuleMatch> list;
-
- public RuleApply(TextMarkerRule rule) {
- this(rule, false);
+
+ public RuleApply(TextMarkerStatement tme, boolean remember) {
+ super(tme);
+ list = new ArrayList<AbstractRuleMatch<? extends AbstractRule>>();
+ this.acceptMatches = remember;
}
- public RuleApply(TextMarkerRule rule, boolean remember) {
- super(rule);
- list = new ArrayList<RuleMatch>();
- acceptMatches = remember;
+ public List<AbstractRuleMatch<? extends AbstractRule>> getList() {
+ return list;
}
- public void add(RuleMatch match) {
+ public void add(AbstractRuleMatch<? extends AbstractRule> match) {
if (match.matchedCompletely()) {
applied++;
}
@@ -53,26 +35,7 @@ public class RuleApply extends ScriptApp
list.add(match);
}
}
-
- public void addAll(List<RuleMatch> matches) {
- for (RuleMatch ruleMatch : matches) {
- add(ruleMatch);
- }
- }
-
- public List<RuleMatch> getList() {
- return list;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(((TextMarkerRule) getElement()).getId() + "\t");
- sb.append(applied + "/" + tried + ":\t");
- sb.append(getElement().toString());
- return sb.toString();
- }
-
+
public int getTried() {
return tried;
}
@@ -88,4 +51,11 @@ public class RuleApply extends ScriptApp
public void setAcceptMatches(boolean acceptMatches) {
this.acceptMatches = acceptMatches;
}
+
+ public void addAll(List<RuleMatch> matches) {
+ for (RuleMatch ruleMatch : matches) {
+ add(ruleMatch);
+ }
+ }
+
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleMatch.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleMatch.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleMatch.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/RuleMatch.java Thu Mar 21 13:44:04 2013
@@ -33,7 +33,7 @@ import org.apache.uima.textmarker.Script
import org.apache.uima.textmarker.TextMarkerStream;
import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
-public class RuleMatch {
+public class RuleMatch extends AbstractRuleMatch<TextMarkerRule> {
private static class RuleMatchComparator implements Comparator<RuleElementMatch> {
@@ -47,12 +47,8 @@ public class RuleMatch {
private RuleMatchComparator ruleElementComparator = new RuleMatchComparator();
- private boolean matched = true;
-
private boolean applied = false;
- private final TextMarkerRule rule;
-
private Map<AbstractTextMarkerAction, ScriptApply> delegateApply;
// private Map<RuleElement, List<RuleElementMatch>> map;
@@ -60,8 +56,7 @@ public class RuleMatch {
private ComposedRuleElementMatch rootMatch;
public RuleMatch(TextMarkerRule rule) {
- super();
- this.rule = rule;
+ super(rule);
// map = new TreeMap<RuleElement, List<RuleElementMatch>>(
// new RuleElementComparator(rule.getRoot()));
delegateApply = new HashMap<AbstractTextMarkerAction, ScriptApply>(0);
@@ -84,9 +79,7 @@ public class RuleMatch {
return result;
}
- public boolean matched() {
- return matched;
- }
+
public boolean matchedCompletely() {
return matched && rootMatch.matched();
@@ -96,12 +89,18 @@ public class RuleMatch {
return getMatchedAnnotations(stream, element.getSelfIndexList(), element.getContainer());
}
+ @Override
+ public List<AnnotationFS> getMatchedAnnotationsOfRoot(TextMarkerStream stream) {
+ return getMatchedAnnotationsOf(((TextMarkerRule)getRule()).getRoot(), stream);
+ }
+
+
public List<AnnotationFS> getMatchedAnnotations(TextMarkerStream stream, List<Integer> indexes,
RuleElementContainer container) {
List<AnnotationFS> result = new ArrayList<AnnotationFS>();
indexes = extendIndexes(indexes);
if (container == null) {
- container = rule.getRoot();
+ container = ((TextMarkerRule)rule).getRoot();
}
// TODO refactor this!
@@ -244,10 +243,6 @@ public class RuleMatch {
this.applied = applied;
}
- public TextMarkerRule getRule() {
- return rule;
- }
-
public ComposedRuleElementMatch getRootMatch() {
return rootMatch;
}
@@ -285,4 +280,6 @@ public class RuleMatch {
}
return result;
}
+
+
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRule.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRule.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/rule/TextMarkerRule.java Thu Mar 21 13:44:04 2013
@@ -23,19 +23,15 @@ import java.util.List;
import org.apache.uima.textmarker.TextMarkerBlock;
import org.apache.uima.textmarker.TextMarkerEnvironment;
-import org.apache.uima.textmarker.TextMarkerStatement;
import org.apache.uima.textmarker.TextMarkerStream;
import org.apache.uima.textmarker.visitor.InferenceCrowd;
-public class TextMarkerRule extends TextMarkerStatement {
+public class TextMarkerRule extends AbstractRule {
private ComposedRuleElement root;
- private final int id;
-
public TextMarkerRule(List<RuleElement> elements, TextMarkerBlock parent, int id) {
- super(parent);
- this.id = id;
+ super(parent, id);
this.root = new ComposedRuleElement(elements, null, null, null, null, parent);
}
@@ -62,10 +58,6 @@ public class TextMarkerRule extends Text
return root.getRuleElements();
}
- public int getId() {
- return id;
- }
-
@Override
public TextMarkerEnvironment getEnvironment() {
return getParent().getEnvironment();
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/DefaultSeeder.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/DefaultSeeder.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/DefaultSeeder.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/DefaultSeeder.java Thu Mar 21 13:44:04 2013
@@ -23,7 +23,6 @@ import java.io.BufferedReader;
import java.io.StringReader;
import java.util.Collection;
import java.util.LinkedList;
-import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -32,7 +31,6 @@ import org.apache.uima.cas.CASException;
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.jcas.JCas;
import org.apache.uima.textmarker.type.MARKUP;
import org.apache.uima.textmarker.type.TokenSeed;
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java Thu Mar 21 13:44:04 2013
@@ -21,12 +21,8 @@
package org.apache.uima.textmarker.seed;
-import java.util.*;
-import java.util.regex.*;
-
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.JCas;
-
import org.apache.uima.textmarker.type.AMP;
import org.apache.uima.textmarker.type.BREAK;
import org.apache.uima.textmarker.type.CAP;
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ActionVerbalizer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ActionVerbalizer.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ActionVerbalizer.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ActionVerbalizer.java Thu Mar 21 13:44:04 2013
@@ -34,26 +34,26 @@ import org.apache.uima.textmarker.action
import org.apache.uima.textmarker.action.DelAction;
import org.apache.uima.textmarker.action.DynamicAnchoringAction;
import org.apache.uima.textmarker.action.ExecAction;
-import org.apache.uima.textmarker.action.GetListAction;
-import org.apache.uima.textmarker.action.MarkTableAction;
-import org.apache.uima.textmarker.action.MatchedTextAction;
-import org.apache.uima.textmarker.action.ShiftAction;
import org.apache.uima.textmarker.action.FillAction;
import org.apache.uima.textmarker.action.FilterTypeAction;
import org.apache.uima.textmarker.action.GatherAction;
import org.apache.uima.textmarker.action.GetAction;
import org.apache.uima.textmarker.action.GetFeatureAction;
+import org.apache.uima.textmarker.action.GetListAction;
import org.apache.uima.textmarker.action.LogAction;
import org.apache.uima.textmarker.action.MarkAction;
import org.apache.uima.textmarker.action.MarkFastAction;
import org.apache.uima.textmarker.action.MarkLastAction;
import org.apache.uima.textmarker.action.MarkOnceAction;
+import org.apache.uima.textmarker.action.MarkTableAction;
+import org.apache.uima.textmarker.action.MatchedTextAction;
import org.apache.uima.textmarker.action.MergeAction;
import org.apache.uima.textmarker.action.RemoveAction;
import org.apache.uima.textmarker.action.RemoveDuplicateAction;
import org.apache.uima.textmarker.action.ReplaceAction;
import org.apache.uima.textmarker.action.RetainTypeAction;
import org.apache.uima.textmarker.action.SetFeatureAction;
+import org.apache.uima.textmarker.action.ShiftAction;
import org.apache.uima.textmarker.action.TransferAction;
import org.apache.uima.textmarker.action.TrieAction;
import org.apache.uima.textmarker.action.UnmarkAction;
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ConditionVerbalizer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ConditionVerbalizer.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ConditionVerbalizer.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ConditionVerbalizer.java Thu Mar 21 13:44:04 2013
@@ -53,7 +53,6 @@ import org.apache.uima.textmarker.condit
import org.apache.uima.textmarker.expression.list.ListExpression;
import org.apache.uima.textmarker.expression.number.NumberExpression;
import org.apache.uima.textmarker.expression.number.SimpleNumberExpression;
-import org.apache.uima.textmarker.expression.string.StringExpression;
public class ConditionVerbalizer {
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java Thu Mar 21 13:44:04 2013
@@ -21,6 +21,7 @@ package org.apache.uima.textmarker.verba
import java.util.Iterator;
import java.util.List;
+import java.util.Map.Entry;
import org.apache.uima.textmarker.TextMarkerBlock;
import org.apache.uima.textmarker.TextMarkerElement;
@@ -28,7 +29,10 @@ import org.apache.uima.textmarker.TextMa
import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.expression.number.NumberExpression;
+import org.apache.uima.textmarker.expression.type.TypeExpression;
import org.apache.uima.textmarker.rule.ComposedRuleElement;
+import org.apache.uima.textmarker.rule.RegExpRule;
import org.apache.uima.textmarker.rule.RuleElement;
import org.apache.uima.textmarker.rule.TextMarkerDisjunctiveMatcher;
import org.apache.uima.textmarker.rule.TextMarkerMatcher;
@@ -47,6 +51,8 @@ import org.apache.uima.textmarker.rule.q
public class ScriptVerbalizer {
+ private static final String THEN = " -> ";
+
private TextMarkerVerbalizer verbalizer;
public ScriptVerbalizer(TextMarkerVerbalizer verbalizer) {
@@ -59,7 +65,7 @@ public class ScriptVerbalizer {
TextMarkerRule rule = block.getRule();
List<TextMarkerStatement> elements = block.getElements();
result.append("BLOCK(");
- result.append(block.getId());
+ result.append(block.getName());
result.append(")");
result.append(" ");
if (rule != null) {
@@ -115,7 +121,7 @@ public class ScriptVerbalizer {
}
}
if (!actions.isEmpty()) {
- result.append(" -> ");
+ result.append(THEN);
Iterator<AbstractTextMarkerAction> ait = actions.iterator();
while (ait.hasNext()) {
AbstractTextMarkerAction each = ait.next();
@@ -198,10 +204,38 @@ public class ScriptVerbalizer {
return verbalizeQuantifier((RuleElementQuantifier) element);
} else if (element instanceof TextMarkerRule) {
return verbalizeRule((TextMarkerRule) element);
+ } else if (element instanceof RegExpRule) {
+ return verbalizeRegExpRule((RegExpRule) element);
} else if (element instanceof TextMarkerRuleElement) {
return verbalizeRuleElement((TextMarkerRuleElement) element);
}
return null;
}
+ private String verbalizeRegExpRule(RegExpRule rule) {
+ StringBuilder sb = new StringBuilder();
+ String regexp = verbalizer.verbalize(rule.getRegExp());
+ sb.append(regexp);
+ sb.append(THEN);
+
+ Iterator<Entry<TypeExpression, NumberExpression>> iterator = rule.getTypeMap().entrySet()
+ .iterator();
+ while (iterator.hasNext()) {
+ Entry<TypeExpression, NumberExpression> next = iterator.next();
+ String type = verbalizer.verbalize(next.getKey());
+ NumberExpression value = next.getValue();
+ if (value != null) {
+ String group = verbalizer.verbalize(value);
+ sb.append(group+" = "+type);
+ } else {
+ sb.append(type);
+ }
+ if(iterator.hasNext()) {
+ sb.append(", ");
+ }
+ }
+ sb.append(";");
+ return sb.toString();
+ }
+
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/CreatedByVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/CreatedByVisitor.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/CreatedByVisitor.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/CreatedByVisitor.java Thu Mar 21 13:44:04 2013
@@ -30,7 +30,8 @@ import org.apache.uima.cas.text.Annotati
import org.apache.uima.textmarker.ScriptApply;
import org.apache.uima.textmarker.TextMarkerElement;
import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.RuleMatch;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
public class CreatedByVisitor implements TextMarkerInferenceVisitor {
@@ -66,7 +67,7 @@ public class CreatedByVisitor implements
}
}
- public void annotationAdded(AnnotationFS annotation, RuleMatch creator) {
+ public void annotationAdded(AnnotationFS annotation, AbstractRuleMatch<? extends AbstractRule> creator) {
CAS cas = annotation.getCAS();
Type t = cas.getTypeSystem().getType(TYPE);
Feature featureRule = t.getFeatureByBaseName(FEATURE_RULE);
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoCollectorVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoCollectorVisitor.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoCollectorVisitor.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoCollectorVisitor.java Thu Mar 21 13:44:04 2013
@@ -33,8 +33,9 @@ import org.apache.uima.textmarker.TextMa
import org.apache.uima.textmarker.TextMarkerModule;
import org.apache.uima.textmarker.TextMarkerStatement;
import org.apache.uima.textmarker.TextMarkerStream;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
import org.apache.uima.textmarker.rule.RuleApply;
-import org.apache.uima.textmarker.rule.RuleMatch;
import org.apache.uima.textmarker.rule.TextMarkerRule;
import org.apache.uima.textmarker.type.DebugScriptApply;
import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
@@ -186,7 +187,7 @@ public class DebugInfoCollectorVisitor i
return null;
}
- public void annotationAdded(AnnotationFS annotation, RuleMatch creator) {
+ public void annotationAdded(AnnotationFS annotation, AbstractRuleMatch<? extends AbstractRule> creator) {
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoFactory.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoFactory.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/DebugInfoFactory.java Thu Mar 21 13:44:04 2013
@@ -33,9 +33,13 @@ import org.apache.uima.textmarker.Script
import org.apache.uima.textmarker.TextMarkerBlock;
import org.apache.uima.textmarker.TextMarkerElement;
import org.apache.uima.textmarker.TextMarkerStream;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
import org.apache.uima.textmarker.rule.ComposedRuleElement;
import org.apache.uima.textmarker.rule.ComposedRuleElementMatch;
import org.apache.uima.textmarker.rule.EvaluatedCondition;
+import org.apache.uima.textmarker.rule.RegExpRule;
+import org.apache.uima.textmarker.rule.RegExpRuleMatch;
import org.apache.uima.textmarker.rule.RuleApply;
import org.apache.uima.textmarker.rule.RuleElement;
import org.apache.uima.textmarker.rule.RuleElementMatch;
@@ -68,7 +72,7 @@ public class DebugInfoFactory {
JCas cas = stream.getJCas();
DebugBlockApply dba = new DebugBlockApply(cas);
AnnotationFS matchedAnnotation = ruleMatch.getMatchedAnnotationsOf(
- ruleMatch.getRule().getRoot(), stream).get(0);
+ ((TextMarkerRule) ruleMatch.getRule()).getRoot(), stream).get(0);
dba.setElement(matchedAnnotation.getCoveredText());
dba.setBegin(matchedAnnotation.getBegin());
dba.setEnd(matchedAnnotation.getEnd());
@@ -99,9 +103,9 @@ public class DebugInfoFactory {
}
counter = 0;
for (List<ScriptApply> list : loops) {
- RuleMatch ruleMatch = blockApply.getRuleApply().getList().get(counter);
- DebugBlockApply dummyBlockApply = createDummyBlockApply(ruleMatch, stream, addToIndex,
- withMatches, timeInfo);
+ AbstractRuleMatch<? extends AbstractRule> ruleMatch = blockApply.getRuleApply().getList().get(counter);
+ DebugBlockApply dummyBlockApply = createDummyBlockApply((RuleMatch) ruleMatch, stream,
+ addToIndex, withMatches, timeInfo);
List<DebugRuleMatch> ruleMatches = new ArrayList<DebugRuleMatch>();
ruleMatches.add(createDebugRuleMatch(ruleMatch, stream, addToIndex, withMatches, timeInfo));
dummyBlockApply.setApplied(1);
@@ -165,7 +169,7 @@ public class DebugInfoFactory {
int begin = Integer.MAX_VALUE;
int end = 0;
if (withMatches) {
- for (RuleMatch match : ruleApply.getList()) {
+ for (AbstractRuleMatch<? extends AbstractRule> match : ruleApply.getList()) {
DebugRuleMatch debugRuleMatch = createDebugRuleMatch(match, stream, addToIndex,
withMatches, timeInfo);
begin = Math.min(begin, debugRuleMatch.getBegin());
@@ -180,7 +184,7 @@ public class DebugInfoFactory {
dra.setElement(verbalizer.verbalize(ruleApply.getElement()));
dra.setApplied(ruleApply.getApplied());
dra.setTried(ruleApply.getTried());
- dra.setId(((TextMarkerRule)ruleApply.getElement()).getId());
+ dra.setId(((AbstractRule) ruleApply.getElement()).getId());
dra.setScript(ruleApply.getElement().getParent().getScript().getRootBlock().getNamespace());
dra.setBegin(begin);
dra.setEnd(end);
@@ -193,7 +197,7 @@ public class DebugInfoFactory {
return dra;
}
- public DebugRuleMatch createDebugRuleMatch(RuleMatch match, TextMarkerStream stream,
+ public DebugRuleMatch createDebugRuleMatch(AbstractRuleMatch<? extends AbstractRule> match, TextMarkerStream stream,
boolean addToIndex, boolean withMatches, Map<TextMarkerElement, Long> timeInfo) {
JCas cas = stream.getJCas();
DebugRuleMatch drm = null;
@@ -202,22 +206,61 @@ public class DebugInfoFactory {
} else {
drm = new DebugFailedRuleMatch(cas);
}
- ComposedRuleElementMatch rootMatch = match.getRootMatch();
- setInnerMatches(stream, addToIndex, cas, drm, rootMatch);
drm.setMatched(match.matchedCompletely());
- if (match.matched()) {
- List<DebugScriptApply> delegates = new ArrayList<DebugScriptApply>();
- for (ScriptApply rem : match.getDelegateApply().values()) {
- delegates.add(createDebugScriptApply(rem, stream, addToIndex, withMatches, timeInfo));
+ if (match instanceof RuleMatch) {
+ ComposedRuleElementMatch rootMatch = ((RuleMatch) match).getRootMatch();
+ setInnerMatches(stream, addToIndex, cas, drm, rootMatch);
+ if (match.matched()) {
+ List<DebugScriptApply> delegates = new ArrayList<DebugScriptApply>();
+ for (ScriptApply rem : ((RuleMatch) match).getDelegateApply().values()) {
+ delegates.add(createDebugScriptApply(rem, stream, addToIndex, withMatches, timeInfo));
+ }
+ drm.setDelegates(UIMAUtils.toFSArray(cas, delegates));
+ }
+ } else if(match instanceof RegExpRuleMatch) {
+ RegExpRuleMatch rerm = (RegExpRuleMatch) match;
+ Map<Integer, List<AnnotationFS>> map = rerm.getMap();
+ Set<Entry<Integer, List<AnnotationFS>>> entrySet = map.entrySet();
+ List<DebugRuleElementMatches> ruleElementMatches = new ArrayList<DebugRuleElementMatches>();
+ for (Entry<Integer, List<AnnotationFS>> entry : entrySet) {
+ DebugRuleElementMatches drems = new DebugRuleElementMatches(cas);
+ RegExpRule rule = rerm.getRule();
+ Integer key = entry.getKey();
+ List<AnnotationFS> value = entry.getValue();
+ drems.setElement(verbalizer.verbalize(rule));
+ List<DebugRuleElementMatch> remList = new ArrayList<DebugRuleElementMatch>();
+ if (value != null) {
+ for (AnnotationFS each : value) {
+ DebugRuleElementMatch drem = new DebugRuleElementMatch(cas);
+
+ DebugEvaluatedCondition base = new DebugEvaluatedCondition(cas);
+ base.setValue(true);
+ String baseString = "Group "+key ;
+ base.setElement(baseString);
+ drem.setBaseCondition(base);
+
+ drem.setBegin(each.getBegin());
+ drem.setEnd(each.getEnd());
+ if (addToIndex) {
+ drem.addToIndexes();
+ }
+ remList.add(drem);
+ }
+ }
+ drems.setMatches(UIMAUtils.toFSArray(cas, remList));
+ if (addToIndex) {
+ drems.addToIndexes();
+ }
+ ruleElementMatches.add(drems);
}
- drm.setDelegates(UIMAUtils.toFSArray(cas, delegates));
+
+ drm.setElements(UIMAUtils.toFSArray(cas, ruleElementMatches));
}
if (timeInfo != null) {
long time = timeInfo.get(match.getRule());
drm.setTime(time);
}
- AnnotationFS matchedAnnotation = match.getMatchedAnnotationsOf(match.getRule().getRoot(),
- stream).get(0);
+ AnnotationFS matchedAnnotation = match.getMatchedAnnotationsOfRoot(stream).get(0);
if (matchedAnnotation != null) {
drm.setBegin(matchedAnnotation.getBegin());
drm.setEnd(matchedAnnotation.getEnd());
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/InferenceCrowd.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/InferenceCrowd.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/InferenceCrowd.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/InferenceCrowd.java Thu Mar 21 13:44:04 2013
@@ -25,7 +25,8 @@ import org.apache.uima.cas.text.Annotati
import org.apache.uima.textmarker.ScriptApply;
import org.apache.uima.textmarker.TextMarkerElement;
import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.RuleMatch;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
public class InferenceCrowd implements TextMarkerInferenceVisitor {
@@ -59,7 +60,7 @@ public class InferenceCrowd implements T
finished(stream);
}
- public void annotationAdded(AnnotationFS annotation, RuleMatch creator) {
+ public void annotationAdded(AnnotationFS annotation, AbstractRuleMatch<? extends AbstractRule> creator) {
for (TextMarkerInferenceVisitor each : visitors) {
each.annotationAdded(annotation, creator);
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/StatisticsVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/StatisticsVisitor.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/StatisticsVisitor.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/StatisticsVisitor.java Thu Mar 21 13:44:04 2013
@@ -37,7 +37,8 @@ import org.apache.uima.textmarker.TextMa
import org.apache.uima.textmarker.TextMarkerStream;
import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
-import org.apache.uima.textmarker.rule.RuleMatch;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
import org.apache.uima.textmarker.type.Statistics;
import org.apache.uima.textmarker.utils.UIMAUtils;
import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
@@ -198,7 +199,7 @@ public class StatisticsVisitor implement
return actionAmount;
}
- public void annotationAdded(AnnotationFS annotation, RuleMatch creator) {
+ public void annotationAdded(AnnotationFS annotation, AbstractRuleMatch<? extends AbstractRule> creator) {
}
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TextMarkerInferenceVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TextMarkerInferenceVisitor.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TextMarkerInferenceVisitor.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TextMarkerInferenceVisitor.java Thu Mar 21 13:44:04 2013
@@ -25,7 +25,8 @@ import org.apache.uima.cas.text.Annotati
import org.apache.uima.textmarker.ScriptApply;
import org.apache.uima.textmarker.TextMarkerElement;
import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.RuleMatch;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
public interface TextMarkerInferenceVisitor {
@@ -36,6 +37,6 @@ public interface TextMarkerInferenceVisi
void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors);
- void annotationAdded(AnnotationFS annotation, RuleMatch creator);
+ void annotationAdded(AnnotationFS annotation, AbstractRuleMatch<? extends AbstractRule> creator);
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TimeProfilerVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TimeProfilerVisitor.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TimeProfilerVisitor.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/main/java/org/apache/uima/textmarker/visitor/TimeProfilerVisitor.java Thu Mar 21 13:44:04 2013
@@ -27,7 +27,8 @@ import org.apache.uima.cas.text.Annotati
import org.apache.uima.textmarker.ScriptApply;
import org.apache.uima.textmarker.TextMarkerElement;
import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.rule.RuleMatch;
+import org.apache.uima.textmarker.rule.AbstractRule;
+import org.apache.uima.textmarker.rule.AbstractRuleMatch;
public class TimeProfilerVisitor implements TextMarkerInferenceVisitor {
@@ -57,7 +58,7 @@ public class TimeProfilerVisitor impleme
return timeInfo;
}
- public void annotationAdded(AnnotationFS annotation, RuleMatch creator) {
+ public void annotationAdded(AnnotationFS annotation, AbstractRuleMatch<? extends AbstractRule> creator) {
}
}
Modified: uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/AllTests.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/AllTests.java?rev=1459309&r1=1459308&r2=1459309&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/AllTests.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/AllTests.java Thu Mar 21 13:44:04 2013
@@ -41,7 +41,7 @@ import org.junit.runners.Suite.SuiteClas
AllActionsTest.class, AllConditionsTest.class, CurrentCountTest.class, PartOfTest.class,
PositionTest.class, DefaultSeederTest.class, ConditionVerbalizerTest.class,
ActionVerbalizerTest.class, ExpressionVerbalizerTest.class, HtmlAnnotatorTest.class,
- HtmlConverterTest.class, EmptyDocumentTest.class, TextMarkerModifierTest.class })
+ HtmlConverterTest.class, EmptyDocumentTest.class, TextMarkerModifierTest.class, RegExpRuleTest.class })
public class AllTests {
}
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/RegExpRuleTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/RegExpRuleTest.java?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/RegExpRuleTest.java (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/test/java/org/apache/uima/textmarker/RegExpRuleTest.java Thu Mar 21 13:44:04 2013
@@ -0,0 +1,105 @@
+/*
+ * 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 RegExpRuleTest {
+
+ @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(1, ai.size());
+ iterator = ai.iterator();
+ assertEquals(28, iterator.next().getCoveredText().length());
+
+ t = TextMarkerTestUtils.getTestType(cas, 2);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(1, ai.size());
+ assertEquals(26, iterator.next().getCoveredText().length());
+
+ t = TextMarkerTestUtils.getTestType(cas, 3);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(2, ai.size());
+ assertEquals("y", iterator.next().getCoveredText());
+ assertEquals("z", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 4);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(2, ai.size());
+ assertEquals("y", iterator.next().getCoveredText());
+ assertEquals("z", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 5);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(3, ai.size());
+ assertEquals("B", iterator.next().getCoveredText());
+ assertEquals("B", iterator.next().getCoveredText());
+ assertEquals("B", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 6);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(2, ai.size());
+ assertEquals("y", iterator.next().getCoveredText());
+ assertEquals("z", iterator.next().getCoveredText());
+
+ t = TextMarkerTestUtils.getTestType(cas, 7);
+ ai = cas.getAnnotationIndex(t);
+ iterator = ai.iterator();
+ assertEquals(3, ai.size());
+ assertEquals("ByB", iterator.next().getCoveredText());
+ assertEquals("BzB", iterator.next().getCoveredText());
+ assertEquals("BB", iterator.next().getCoveredText());
+
+
+
+ if (cas != null) {
+ cas.release();
+ }
+
+ }
+}
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.tm
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.tm?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.tm (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.tm Thu Mar 21 13:44:04 2013
@@ -0,0 +1,18 @@
+PACKAGE org.apache.uima;
+
+DECLARE T1, T2, T3, T4, T5, T6, T7;
+
+"A(.*?)C" -> T1, 1 = T2;
+
+"^B(.*?)B" -> T7, 1 = T3;
+
+"B(.*?)B(.)" -> 1 = T4, 2 = T5;
+
+
+BLOCK(limited) T7{} {
+ "B(.*?)B" -> 1 = T6;
+}
+
+
+
+
Added: uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.txt?rev=1459309&view=auto
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.txt (added)
+++ uima/sandbox/textmarker/trunk/textmarker-core/src/test/resources/org/apache/uima/textmarker/RegExpRuleTest.txt Thu Mar 21 13:44:04 2013
@@ -0,0 +1,7 @@
+AxAA
+
+ByBB
+BzBB
+BBB
+
+CCC
\ No newline at end of file