Search code examples
nlpuimaruta

If-Then-Else in Ruta


is there something like if then else in Ruta available? I'd like to do something like:

if there's at least one term from catA, then label the document with "one" else if there's at least one term from catB, then label the document with "two" else label the document with "three".

All the best Philipp


Solution

  • There is no language structure for if-then-else in UIMA Ruta (2.7.0).

    You need to duplicate some parts of the rule in order to model the else part, e.g., something like the following:

    Document{CONTAINS(CatA) -> One};
    Document{-CONTAINS(CatA), CONTAINS(CatB) -> Two};
    Document{-CONTAINS(CatA), -CONTAINS(CatB) -> Three};
    

    You could also check if the previous rule has matched and depend on that.

    How the rule should actually look like depends mainly on the type system and how you want to model the information (features?).

    DISCLAIMER: I am a developer of UIMA Ruta