Search code examples
javauimaruta

UIMA Ruta: set feature with MARKONCE action


MARKONCE: I have a sequence of sentences ending with question sign, and I want to annotate the entire span at once. So, I use MARKONCE to accomplish this task.

Now, I also need to set the feature for this newly created annotation. How to set the feature through MARKONCE ? (in the same manner like CREATE action allows).

In other words, I would like to have:

String testRule = (Sentence{ENDSWITH(QUESTION)})[2,10]{->MARKONCE(QuestionSeq, "deviceType"="parallelism")};

Why is it not possible and what would the solution(if any) be?

Thank you in advance.


Solution

  • It is not possible with MARKONCE because MARKONCE is a really simple action.

    However, there are several ways to do this in Ruta. Here are two examples:

    You could avoid additional matches, e.g., with -PARTOF():

    (Sentence{-PARTOF(QuestionSeq), ENDSWITH(QUESTION)})[2,10]
           {->CREATE(QuestionSeq, "deviceType"="parallelism")};
    

    or you could simply set the feature value with a separate action:

    (Sentence{ENDSWITH(QUESTION)})[2,10]
           {->MARKONCE(QuestionSeq), QuestionSeq.deviceType="parallelism")};
    

    DISCLAIMER: I am a developer of UIMA Ruta