Search code examples
rutaclamp

CLAMP can not run the Ruta Rules for predicting the relationships


I am trying to implement relationship ruta rules same as in this video (https://www.youtube.com/watch?time_continue=1105&v=8PYvzswOXog). However, I can not get the results of any relationships. I did perfectly follow everything in his demo.

Any help is appreciated.

BLOCK (ForEach) Sentence{}{                                                                                                                       
   ClampNameEntityUIMA { FEATURE ( "semanticTag", "test")}
   BaseToken??{REGEXP("grade")}
   ClampNameEntityUIMA { FEATURE ( "semanticTag", "Date" ) -> CREATE( ClampRelationUIMA, "entFrom"=3, "entTo"=1), SETFEATURE("semanticTag", "testdate")};                                                            
}

BLOCK (ForEach) Sentence{}{
    ClampNameEntityUIMA { FEATURE ( "semanticTag", "test")}
    BaseToken??{REGEXP("[grade\\s]*")}
    ClampNameEntityUIMA { FEATURE ( "semanticTag", "value" ) -> CREATE( ClampRelationUIMA, "entFrom"=3, "entTo"=1), SETFEATURE("semanticTag", "testvalue")};
}

Solution

  • It looks like that you actually want to use the GATHER action instead of the CREATE action. The GATHER action is able to assign the values of a feature using the index of the rule element whereas the matched annotation of the matching condition is assigned to the feature. The CREATE action tries to assign the given argument to the feature. In your example, that is an integer for a feature with an annotation range, which will result in no assignment.

    Your block could look like:

    BLOCK (ForEach) Sentence{}{                                                                                                                       
       ClampNameEntityUIMA { FEATURE ( "semanticTag", "test")}
       BaseToken??{REGEXP("grade")}
       ClampNameEntityUIMA { FEATURE ( "semanticTag", "Date" ) -> GATHER( ClampRelationUIMA, "entFrom"=3, "entTo"=1), SETFEATURE("semanticTag", "testdate")};                                                            
    }
    

    DISCLAIMER: I ama developer of UIMA Ruta