Search code examples
nlpuimalinguisticsruta

UIMA Ruta Create Label over multiple Fields


I am creating my own types which should consist of an label. The Label needs to include the whole matched String (for further processing)

For Exampel this would be my rule:

(W{REGEXP("myregex1")} W{REGEXP("myregex2")}) { -> CREATE(MyType, "label"=?)}

You can see the question mark behind the "label" part. Is it possible to transfer the matched string to that label?


Solution

  • This is normally done with something like the MATCHEDTEXT action and a STRING variable:

    STRING mt;
    (W{REGEXP("myregex1")} W{REGEXP("myregex2")}) { -> MATCHEDTEXT(mt), CREATE(MyType, "label"=mt)};
    

    With UIMA Ruta 2.5.0 (upcoming release) you can also use the implicit coveredText feature of a local annotation variable (label):

    m:(W{REGEXP("myregex1")} W{REGEXP("myregex2")}) { -> CREATE(MyType, "label"=m.ct)};
    

    DISCLAIMER: I am a developer of UIMA Ruta