Search code examples
uimaruta

Setting Features-Uima Ruta


I am trying "learning by example" which was given in the uima ruta documentation.I have tried how to define and assign a relation of employment, by storing the given annotations as feature values.But I got error messages.I'm not clear in that concept can explain me in detail.

DECLARE Annotation EmplRelation 
(Employee employeeRef, Employer employerRef);
Sentence{CONTAINS(EmploymentIndicator) -> CREATE(EmplRelation,"employeeRef" = Employee, "employerRef" = Employer)};
e1:Employer # EmploymentIndicator # e2:Employee) {-> EmplRelation, EmplRelation.employeeRef=e2, EmplRelation.employerRef=e1};

Solution

  • Just assuming what the mentioned error messages could be: The script in the question is not complete. The section "learning by example" does not contain always complete scripts but builts upon previous examples. A complete and running script for this example could look like (for an input text like "Peter works for Frank."):

    DECLARE Employee, Employer, EmploymentIndicator, Sentence;
    DECLARE EmplRelation (Employee employeeRef, Employer employerRef);
    
    // create some dummy annotations to work on
    "Peter" -> Employee;
    "Frank" -> Employer;
    "works for" -> EmploymentIndicator;
    (# PERIOD){-> Sentence};
    
    // the actual rules
    Sentence{CONTAINS(EmploymentIndicator) -> CREATE(EmplRelation,"employeeRef" = Employee, "employerRef" = Employer)};
    (e1:Employee # EmploymentIndicator # e2:Employer) {-> EmplRelation, EmplRelation.employeeRef=e1, EmplRelation.employerRef=e2};
    

    Please mind that I modified the last rule so that it works on the minimal example.

    DISCLAIMER: I am a developer of UIMA Ruta