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 2018/12/18 20:31:53 UTC
svn commit: r1849229 - in /uima/ruta/trunk/ruta-core: ./
src/main/java/org/apache/uima/ruta/seed/ src/main/jflex/
src/main/jflex/org/ src/main/jflex/org/apache/
src/main/jflex/org/apache/uima/ src/main/jflex/org/apache/uima/ruta/
src/main/jflex/org/apa...
Author: pkluegl
Date: Tue Dec 18 20:31:53 2018
New Revision: 1849229
URL: http://svn.apache.org/viewvc?rev=1849229&view=rev
Log:
UIMA-5903: added jflex maven, added vtab, added test
Added:
uima/ruta/trunk/ruta-core/src/main/jflex/
uima/ruta/trunk/ruta-core/src/main/jflex/org/
uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/
uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/
uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/ruta/
uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/ruta/seed/
uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/ruta/seed/SeedLexer.flex
- copied, changed from r1849228, uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/seed/SeedLexer.flex
Removed:
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/seed/SeedLexer.flex
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/seed/SeedLexer.java
Modified:
uima/ruta/trunk/ruta-core/pom.xml
uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/seed/DefaultSeederTest.java
Modified: uima/ruta/trunk/ruta-core/pom.xml
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/pom.xml?rev=1849229&r1=1849228&r2=1849229&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/pom.xml (original)
+++ uima/ruta/trunk/ruta-core/pom.xml Tue Dec 18 20:31:53 2018
@@ -154,6 +154,33 @@
</execution>
</executions>
</plugin>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>de.jflex</groupId>
+ <artifactId>
+ jflex-maven-plugin
+ </artifactId>
+ <versionRange>[1.6.1,)</versionRange>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
<resources>
@@ -193,6 +220,38 @@
</source>
</sources>
</configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>de.jflex</groupId>
+ <artifactId>jflex-maven-plugin</artifactId>
+ <version>1.6.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/target/generated-sources/jflex
+ </source>
+ </sources>
+ </configuration>
</execution>
</executions>
</plugin>
Copied: uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/ruta/seed/SeedLexer.flex (from r1849228, uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/seed/SeedLexer.flex)
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/ruta/seed/SeedLexer.flex?p2=uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/ruta/seed/SeedLexer.flex&p1=uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/seed/SeedLexer.flex&r1=1849228&r2=1849229&rev=1849229&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/seed/SeedLexer.flex (original)
+++ uima/ruta/trunk/ruta-core/src/main/jflex/org/apache/uima/ruta/seed/SeedLexer.flex Tue Dec 18 20:31:53 2018
@@ -61,7 +61,7 @@ import org.apache.uima.ruta.type.SW;
ALPHA=[A-Za-z]
DIGIT=[0-9]
WHITE_SPACE_CHAR=[\n\r\ \t\b\012]
-BREAK=[\n\r\b\012]
+BREAK=[\n\r\b\012\u000b]
SPACE=[ \t]
%%
Modified: uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/seed/DefaultSeederTest.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/seed/DefaultSeederTest.java?rev=1849229&r1=1849228&r2=1849229&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/seed/DefaultSeederTest.java (original)
+++ uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/seed/DefaultSeederTest.java Tue Dec 18 20:31:53 2018
@@ -40,13 +40,12 @@ import org.junit.Test;
public class DefaultSeederTest {
-
-
@Test
public void test() throws Exception {
URL url = RutaEngine.class.getClassLoader().getResource("BasicEngine.xml");
if (url == null) {
- url = RutaTestUtils.class.getClassLoader().getResource("org/apache/uima/ruta/engine/BasicEngine.xml");
+ url = RutaTestUtils.class.getClassLoader()
+ .getResource("org/apache/uima/ruta/engine/BasicEngine.xml");
}
XMLInputSource in = new XMLInputSource(url);
ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
@@ -113,17 +112,12 @@ public class DefaultSeederTest {
public void testMarkup() throws Exception {
String document = "<xref ref-type=\"bibr\" rid=\"b35-ehp0113-000220\">"
+ "<sec sec-type=\"methods\">" + "<sec sectype=\"methods\">"
- + "<sec sec-type=\"methods\">" + "<sec sectype=\"methods\">"
- + "<sec sectype='methods'>" + "<tag-with-dash value=\"1\">"
- + "<-not-a-real-tag value=\"1\">" + "<a_real_tag value=\"1\">";
+ + "<sec sec-type=\"methods\">" + "<sec sectype=\"methods\">" + "<sec sectype='methods'>"
+ + "<tag-with-dash value=\"1\">" + "<-not-a-real-tag value=\"1\">"
+ + "<a_real_tag value=\"1\">";
String script = "RETAINTYPE(MARKUP);MARKUP{-> T1};";
- CAS cas = null;
- try {
- cas = RutaTestUtils.getCAS(document);
- Ruta.apply(cas, script);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ CAS cas = RutaTestUtils.getCAS(document);
+ Ruta.apply(cas, script);
RutaTestUtils.assertAnnotationsEquals(cas, 1, 8,
"<xref ref-type=\"bibr\" rid=\"b35-ehp0113-000220\">", "<sec sec-type=\"methods\">",
@@ -132,7 +126,7 @@ public class DefaultSeederTest {
cas.release();
}
-
+
@Test
public void testStackedMarkup() throws Exception {
StringBuilder sb = new StringBuilder();
@@ -144,20 +138,11 @@ public class DefaultSeederTest {
sb.append("</b>");
}
- // long start = System.currentTimeMillis();
-
String document = sb.toString();
String script = "RETAINTYPE(MARKUP);MARKUP{-> T1};";
- CAS cas = null;
- try {
- cas = RutaTestUtils.getCAS(document);
- Ruta.apply(cas, script);
- } catch (Exception e) {
- e.printStackTrace();
- }
- // long end = System.currentTimeMillis();
+ CAS cas = RutaTestUtils.getCAS(document);
+ Ruta.apply(cas, script);
- // System.out.println("took: " + (end-start)/1000 + "s");
Type t1 = RutaTestUtils.getTestType(cas, 1);
AnnotationIndex<AnnotationFS> ai = cas.getAnnotationIndex(t1);
Assert.assertEquals(2000, ai.size());
@@ -166,4 +151,15 @@ public class DefaultSeederTest {
}
+ @Test
+ public void testVerticalTab() throws Exception {
+
+ String document = "Some \u000b text.";
+ String script = "RETAINTYPE(WS);\nBREAK{->T1};";
+ CAS cas = RutaTestUtils.getCAS(document);
+ Ruta.apply(cas, script);
+
+ RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "\u000b");
+ }
+
}