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/25 09:41:25 UTC

svn commit: r1757640 - in /uima/ruta/trunk: ruta-docbook/src/docbook/tools.ruta.language.syntax.xml ruta-docbook/src/docbook/tools.ruta.language.xml ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g

Author: pkluegl
Date: Thu Aug 25 09:41:25 2016
New Revision: 1757640

URL: http://svn.apache.org/viewvc?rev=1757640&view=rev
Log:
UIMA-4623
- mention in docu
- adapted ide parser

Modified:
    uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml
    uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.xml
    uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g

Modified: uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml?rev=1757640&r1=1757639&r2=1757640&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml (original)
+++ uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml Thu Aug 25 09:41:25 2016
@@ -84,8 +84,8 @@ VariableDeclaration -> (("TYPE" Identifi
                      | ("BOOLEAN" Identifier ("," Identifier)*
                                                 ("=" BooleanExpression)?)
                      | ("ANNOTATION" Identifier ("=" AnnotationExpression)?)
-                     | ("WORDLIST" Identifier ("=" WordListExpression)?)
-                     | ("WORDTABLE" Identifier ("=" WordTableExpression)?)
+                     | ("WORDLIST" Identifier ("=" WordListExpression | StringExpression)?)
+                     | ("WORDTABLE" Identifier ("=" WordTableExpression | StringExpression)?)
                      | ("TYPELIST" Identifier ("=" TypeListExpression)?)
                      | ("STRINGLIST" Identifier
                                              ("=" StringListExpression)?)

Modified: uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.xml
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.xml?rev=1757640&r1=1757639&r2=1757640&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.xml (original)
+++ uima/ruta/trunk/ruta-docbook/src/docbook/tools.ruta.language.xml Thu Aug 25 09:41:25 2016
@@ -697,21 +697,23 @@ Martin
         listed
         names, could be annotated
         by using
-        <literal>Document{->MARKFAST(FirstName, "FirstNames.txt")};</literal>
+        <literal>Document{->MARKFAST(FirstName, 'FirstNames.txt')};</literal>
         , assuming
         an already declared type FirstName. To make this rule
         recognizing more first names,
         add
         them to the external list.
         You could also use a WORLIST variable to do the same thing as
-        follows:
+        follows, which is preferable:
         <programlisting><![CDATA[WORDLIST FirstNameList = 'FirstNames.txt';
 DECLARE FirstName;
 Document{->MARKFAST(FirstName, FirstNameList)};
 ]]></programlisting>
-      </para>
+
+
+      </para>      
       <para>
-        Another possibility to provide WORDLISTs is the use of compiled
+        Another possibility compared to the plain text files to provide WORDLISTs is the use of compiled
         <quote>tree word list</quote>
         s. The file ending for this is
         <quote>.twl</quote>
@@ -731,7 +733,7 @@ Document{->MARKFAST(FirstName, FirstName
         .
         A tree word list is used in the same way as simple word lists,
         for example
-        <literal>Document{->MARKFAST(FirstName, "FirstNames.twl")};</literal>
+        <literal>Document{->MARKFAST(FirstName, 'FirstNames.twl')};</literal>
         .
       </para>
       <para>
@@ -771,6 +773,15 @@ Declare FirstName, LastName;
 Document{->TRIE("FirstNames.txt" = FirstName, "LastNames.txt" = LastName,
     Names, false, 0, false, 0, "")};]]></programlisting>
       </para>
+      <para>
+              Only if the wordlist is explicitly declared with WORDLIST, then also a StringExpression including variables can be applied to specify the file:
+        <programlisting><![CDATA[STRING package ="my/package/";
+WORDLIST FirstNameList = "" + package + "FirstNames.txt';
+DECLARE FirstName;
+Document{->MARKFAST(FirstName, FirstNameList)};
+]]></programlisting>
+      </para>
+      
     </section>
     <section>
       <title>WORDTABLEs</title>
@@ -809,6 +820,12 @@ DECLARE Annotation PresidentOfUSA(STRING
 Document{->MARKTABLE(PresidentOfUSA, 1, presidentsOfUSA, "party" = 2, 
 		"yearOfInauguration" = 3)};]]></programlisting>
       </para>
+      <para>
+              Only if the wordtable is explicitly declared with WORDTABLE, then also a StringExpression including variables can be applied to specify the file:
+        <programlisting><![CDATA[STRING package ="my/package/";
+WORDTABLE presidentsOfUSA = "" + package + "presidentsOfUSA.csv";
+]]></programlisting>
+      </para>
     </section>
   </section>
   <section id="ugr.tools.ruta.language.regexprule">

Modified: uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g?rev=1757640&r1=1757639&r2=1757640&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g (original)
+++ uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g Thu Aug 25 09:41:25 2016
@@ -486,18 +486,18 @@ variableDeclaration returns [List<Statem
 		 stmts.add(StatementFactory.createDeclarationsStatement(type, decls, init));
 		 }
         |
-        type = WORDLIST id = Identifier (ASSIGN_EQUAL list = wordListExpression)? SEMI
+        type = WORDLIST id = Identifier (ASSIGN_EQUAL (wl = wordListExpression | wl = stringExpression))? SEMI
         {
         addVariable(id.getText(), type.getText());
-        decls.add(StatementFactory.createListVariable(id,type,list));
-        stmts.add(StatementFactory.createDeclarationsStatement(type, decls, list));
+        decls.add(StatementFactory.createListVariable(id,type,wl));
+        stmts.add(StatementFactory.createDeclarationsStatement(type, decls, wl));
         }
         |
-        type = WORDTABLE id = Identifier (ASSIGN_EQUAL table = wordTableExpression)?  SEMI
+        type = WORDTABLE id = Identifier (ASSIGN_EQUAL (wt = wordTableExpression | wt = stringExpression))?  SEMI
         {
         addVariable(id.getText(), type.getText());
-        decls.add(StatementFactory.createTableVariable(id,type,table));
-        stmts.add(StatementFactory.createDeclarationsStatement(type, decls, table));
+        decls.add(StatementFactory.createTableVariable(id,type,wt));
+        stmts.add(StatementFactory.createDeclarationsStatement(type, decls, wt));
         }
         |
         type = BOOLEANLIST id = Identifier (ASSIGN_EQUAL list = booleanListExpression)?  SEMI