beyondTheGatesOfDoom
beyondTheGatesOfDoom

Reputation: 25

UIMA Ruta matching features using regular expression

I've been able to use Ruta with great success to create annotations using the RegExpRule and REGEXP. However, I've run into a slight block. I have annotations created by another engine that assign String features that are essentially comments.

STRING featureComment;
OtherEngineAnnotation{GETFEATURE("comment", featureComment)};
//featureComment = "some comment like text"

Because the feature values might not occur in the document I can't use the RegExpRules to annotate the feature value. I wanted to be able to search the featureComment using as an example the regular expression:

like\stext$

Based on my reading of the documentation this doesn't seem possible. I was wondering if there is another way this can be done?

Essentially can a regex pattern be checked against a Ruta STRING?

Upvotes: 1

Views: 513

Answers (1)

Peter Kluegl
Peter Kluegl

Reputation: 3113

The REGEXP condition can also work on variables or feature values, an optional first argument A rule could look like:

OtherEngineAnnotation{REGEXP(OtherEngineAnnotation.comment, "like\\stext$")};

or

o:OtherEngineAnnotation{REGEXP(o.comment, "like\\stext$")};

Please mind the verison of UIMA Ruta. You need probably at least UIMA Ruta 2.5.0.

DISCLAIMER: I am a developer of UIMA Ruta

Upvotes: 1

Related Questions