uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolf-Dietrich Materna <wolf-dietrich.mate...@empolis.com>
Subject Ruta: order while execution of actions in rule?
Date Wed, 26 Apr 2017 12:18:02 GMT
Hello,
I have a problem with the execution order of actions in rules.
I want to use Ruta to extract numeric values and convert them for different units.
Example input & expected output:
“10 %” => annotation “Percent” with value 10.0
“10 ‰” => annotation “Percent” with value 1.0
I wrote some simple rules for testing:
DECLARE Annotation Percent(STRING class, FLOAT value, STRING unit );
FLOAT a2,a1;
// works as expected: value is 10.0 for input "10 %"
(NUM{PARSE(a1)} "%") {-> CREATE (Percent, "value" = a1, "class" = "Percent", "unit" = "%")};
// Example 2: => returns wrong value 0.0. ASSIGN() is excecuted after CREATE() ?
(NUM{PARSE(a1)} "‰") {-> ASSIGN(a1, a1/10), CREATE (Percent, "value" = a1, "class" =
"Percent", "unit" = "‰")};
I tried Ruta 2.3.1 and 2.6.0, but the second rule doesn’t work as expected.
The Percent annotation, which is created for “10 ‰”, has the value 10.0.

It seems that the CREATE() action is executed before the ASSIGN() action.
Is there any way to force Ruta to execute the ASSIGN() as first action?
I expected that Ruta executes the actions from left to right, but in this case the order is
different.
I already tried other variants of the second rule, but this didn’t help:
// returns value = 0.0 in annotation
NUM{PARSE(a1) -> ASSIGN(a2, a1/10.0)} Tmpp10 {-> CREATE (Percent, 1,2, "value" = a2,
"class" = "Percent", "unit" = "‰")};
Thank you in advance for an explanation or hint to solve the issue.
                Wolf-Dietrich Materna



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message