Search code examples
annotationsuimaruta

UIMA RUTA Combination of Annotations


I am new to UIMA RUTA and after reading the UIMA RUTA Guide, I have the following question. I want to write a set of rules that will search for two annotations (FIRST, SECOND) inside my document with specific values (FIRST: "hello" and SECOND: "world","pres") and if they find them it will create a new annotation (THIRD) with value:"end". However, the script is not working and I am wondering why.

WORDTABLE Firsts= 'FIRST.csv';
WORDTABLE Seconds= 'SECOND.csv';
WORDTABLE Thirds= 'THIRD.csv';
DECLARE Annotation FIRST(STRING value);
DECLARE Annotation SECOND(STRING value, STRING pos);
DECLARE Annotation THIRD(STRING value);
Document{->MARKTABLE(FIRST, 1, Firsts, "value"=2)};
Document{->MARKTABLE(SECOND, 1, Seconds, "value"=2, "pos"=3)};
Document{AND(CONTAINS(FIRST{FEATURE("value","hello")}),CONTAINS(SECOND{FEATURE("value","world","pos","pres")})){->CREATE(THIRD{FEATURE("value","end")})}};

Could you please help me out? Thanx.


Solution

  • The last rule is not valid.

    You could write something like:

    (f:FIRST{f.value=="hello"} # s:SECOND{s.value=="world",s.pos=="pres"}){-> CREATE(THIRD, "value" = "end")};
    

    or

    Document{-> CREATE(THIRD, "value" = "end")}<-{f:FIRST{f.value=="hello"} # s:SECOND{s.value=="world",s.pos=="pres"};};
    

    or something with a conjunct rule.

    DISCLAIMER: I am a developer of UIMA Ruta