You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Markus Krug (JIRA)" <de...@uima.apache.org> on 2014/06/17 12:24:01 UTC

[jira] [Created] (UIMA-3898) Update of the Apache UIMA™ Ruta Guide and Reference

Markus Krug created UIMA-3898:
---------------------------------

             Summary: Update of the Apache UIMA™ Ruta Guide and Reference
                 Key: UIMA-3898
                 URL: https://issues.apache.org/jira/browse/UIMA-3898
             Project: UIMA
          Issue Type: Improvement
          Components: Documentation
            Reporter: Markus Krug
            Priority: Minor


In the actual Guidelines available at https://uima.apache.org/d/ruta-current/tools.ruta.book.pdf in section 1.5.1.1 example code of how to run a Ruta script is shown. This code needs some updates as it seems outdated. Below i copied the actual content of the guidelines and marked everything which needs a change in red

{quote}
URL aedesc = RutaEngine.class.getResource("BasicEngine.xml");
XMLInputSource inae = new XMLInputSource(aedesc);
ResourceSpecifier specifier = UIMAFramework.getXMLParser().
parseResourceSpecifier(inae);
ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
AnalysisEngineDescription aed = (AnalysisEngineDescription) specifier;
TypeSystemDescription basicTypeSystem = aed.getAnalysisEngineMetaData().
getTypeSystem();
Collection<TypeSystemDescription> tsds =
new ArrayList<TypeSystemDescription>();
tsds.add(basicTypeSystem);
// add some other type system descriptors
// that are needed by your script file
TypeSystemDescription mergeTypeSystems = CasCreationUtils.
mergeTypeSystems(tsds);
aed.getAnalysisEngineMetaData().setTypeSystem(mergeTypeSystems);
aed.resolveImports(resMgr);
AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aed,
resMgr, null);
File scriptFile = new File("path/to/file/MyScript.ruta");
ae.setConfigParameterValue(RutaEngine.{color:red}SCRIPT_PATHS{color},
new String[] ( scriptFile.getParentFile().getAbsolutePath() ));
String name = scriptFile.getName().substring(0,
scriptFile.getName().length() - {color:red}3{color});
ae.setConfigParameterValue(RutaEngine.{color:red}MAIN_SCRIPT{color}, name);
ae.reconfigure();
CAS cas = ae.newCAS();
cas.setDocumentText("This is my document.");
ae.process(cas);
{quote}

The first change needs to be a -5 instead of a -3 since Ruta files now end with .ruta and no longer with .tm

The second and third change refer to the names of the variables, now they start with PARAM_ 

except for that the code is still working as expected

I thought it might help if this would be fixed




--
This message was sent by Atlassian JIRA
(v6.2#6252)