You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2016/08/05 14:39:16 UTC
svn commit: r1755333 - in /uima/ruta/trunk:
ruta-core/src/test/java/org/apache/uima/ruta/condition/ParseTest.java
ruta-docbook/src/docbook/tools.ruta.language.conditions.xml
Author: pkluegl
Date: Fri Aug 5 14:39:16 2016
New Revision: 1755333
URL: http://svn.apache.org/viewvc?rev=1755333&view=rev
Log:
no jira - add test and explain behavior of PARSE
Modified:
uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/condition/ParseTest.java
uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.conditions.xml
Modified: uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/condition/ParseTest.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/condition/ParseTest.java?rev=1755333&r1=1755332&r2=1755333&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/condition/ParseTest.java (original)
+++ uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/condition/ParseTest.java Fri Aug 5 14:39:16 2016
@@ -20,6 +20,7 @@
package org.apache.uima.ruta.condition;
import org.apache.uima.cas.CAS;
+import org.apache.uima.ruta.engine.Ruta;
import org.apache.uima.ruta.engine.RutaTestUtils;
import org.junit.Test;
@@ -38,4 +39,22 @@ public class ParseTest {
cas.release();
}
+
+ @Test
+ public void testDecimal() throws Exception {
+
+ CAS cas = RutaTestUtils.getCAS("text 2.3 text 2,3 text");
+ Ruta.apply(cas, "DOUBLE d; (NUM PM NUM){PARSE(d),d==2.3 -> T1};");
+ Ruta.apply(cas, "DOUBLE d; (NUM PM NUM){PARSE(d, \"en\"),d==2.3 -> T2};");
+ Ruta.apply(cas, "DOUBLE d; (NUM PM NUM){PARSE(d, \"de\"),d==2.3 -> T3};");
+ Ruta.apply(cas, "DOUBLE d; (NUM PM NUM){PARSE(d, \"en\"),d!=2.3 -> T4};");
+ Ruta.apply(cas, "DOUBLE d; (NUM PM NUM){PARSE(d, \"de\"),d!=2.3 -> T5};");
+
+ RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "2.3");
+ RutaTestUtils.assertAnnotationsEquals(cas, 2, 1, "2.3");
+ RutaTestUtils.assertAnnotationsEquals(cas, 3, 1, "2,3");
+ RutaTestUtils.assertAnnotationsEquals(cas, 4, 1, "2,3");
+ RutaTestUtils.assertAnnotationsEquals(cas, 5, 1, "2.3");
+ }
+
}
Modified: uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.conditions.xml
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.conditions.xml?rev=1755333&r1=1755332&r2=1755333&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.conditions.xml (original)
+++ uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.conditions.xml Fri Aug 5 14:39:16 2016
@@ -608,7 +608,10 @@
The PARSE condition is fulfilled, if the text covered by the
matched annotation can be transformed into a value of the given
variable's type. If this is possible, the parsed value is
- additionally assigned to the passed variable.
+ additionally assigned to the passed variable. For numeric values,
+ this conditions delegates to the NumberFormat of the locale given by the optional
+ second argument. Therefore, this condition parses the string <quote>2,3</quote> for the locale
+ <quote>en</quote> to the value 23.
</para>
<section>
<title>