Description
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
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.SCRIPT_PATHS,
new String[] ( scriptFile.getParentFile().getAbsolutePath() ));
String name = scriptFile.getName().substring(0,
scriptFile.getName().length() - 3);
ae.setConfigParameterValue(RutaEngine.MAIN_SCRIPT, name);
ae.reconfigure();
CAS cas = ae.newCAS();
cas.setDocumentText("This is my document.");
ae.process(cas);
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