Reputation: 67
I am trying to extract the last 3 characters from a pattern using below script. But its not working for patterns given without spaces.
Below is code that I have tried:
((W|NUM)* (W|NUM)*){REGEXP(".{2}")-> MARK(VarA)}
(WS|"-")?
((W|NUM)* (W|NUM)*){REGEXP(".{7}")-> MARK(VarB)}
(WS|"-")?
W{REGEXP(".{3}")-> MARK(VarC),MARK(EntityType,1,5), UNMARK(VarA), UNMARK(VarB), UNMARK(VarC)};
Example 1:
I/P : A1-1B1A21A-PAD
O/P : PAD
Example 2:
I/P : A11B1A21APAD
Exp OP : PAD
The 1st example is working fine. But its not working for 2nd example. Its not recognizing when given without "space"
Please share your thoughts. Thanks in advance.
Upvotes: 0
Views: 249
Reputation: 547
If you just want to extract the last 3 characters of any string in UIMA Ruta, then the following rule should do the job:
"(...)$" -> 1 = VarC;
You could then filter out the matched false positives.
Upvotes: 1