Hi,

ENGINE loads a xml descriptor. In simple Ruta projects they are located in descriptor/utils which would result in 'ENGINE utils.HtmlAnnotator;'. Loading the xml descriptor from the dependency or even the installed OSGi bundle should also work. I would have to check what the exact problem is in the project configuration.

However, if you want to load an analysis engine from the maven dependencies, it is simpler to initialize it directly with uimaFIT instead of the xml descriptor. This would result in something like 'UIMAFIT org.apache.uima.ruta.engine.HtmlAnnotator;'.

It should not look relative to the current package, but I have to check that.

Best,

Peter


Am 21.04.2022 um 10:20 schrieb Michael B.:
Hi Peter!

Bonus question: how do I get Engines and Type Systems included through maven dependencies to resolve correctly in scripts?

For instance:

PACKAGE de.miba;

ENGINE org.apache.uima.ruta.engine.HtmlAnnotator;
ENGINE org.apache.uima.ruta.engine.HtmlConverter;
TYPESYSTEM utils.HtmlTypeSystem;
TYPESYSTEM utils.SourceDocumentInformation;

Document{-> RETAINTYPE(SPACE,BREAK)};
Document{-> EXEC(HtmlAnnotator)};

Document { -> CONFIGURE(HtmlConverter, "inputView" = "_InitialView",
    "outputView" = "plain"),
      EXEC(HtmlConverter)};

All the ruta dependencies are on the class path, but the script can't find it ("error: "org.apache.uima.ruta.engine.HtmlAnnotator" not found.). I assume it's looking relative to current package (de.miba.*)?


Regards,

Michael

Am 14/04/2022 um 14:46 schrieb Peter Klügl:
Hi,

I had a quick look at your ruta-test project.

1. There was problem for the paths config of your annotator description. If you use a java/maven project, it is easier to just use the classpath instead of the Ruta paths. So I removed 'descriptor:descriptor' from the pom and moved the descriptor folder to src/main/resources.

2. I added 'TYPESYSTEM descriptor.typeSystemDescriptor;' to your TestProjectMain.ruta (after the UIMAFIT import) and deleted the JCas cover class in 'src/main/java' as it is now generated and located at 'target/...'

3. I added a '.addToIndexes()' in TestAnno so that the annotation is available and added 'EXEC(TestAnno);' in TestProjectMain.ruta so that the annotator is executed. The keyword UIMAFIT is just an import of the analysis engine.

4. I added 'Assert.assertEquals(1, JCasUtil.select(jcas, SomeType.class).size());' to RutaTest.java in order to check if the annotation is created.

If you want, I can open a pull request with the changes for your project or for a fork.

Best

Peter


Am 13.04.2022 um 16:06 schrieb Michael B.:
Hi everyone!

I'm at a loss here. Trying to create a basic RUTA project, but I just can't get it to work. I'd like to include a custom Engine (Java code!) that needs a few maven dependencies. I just can't get RUTA (via ENGINE/TYPESYSTEM) to properly include and initialize Java annotators.

What I tried so far:

- Create project using archetype

- Add code for custom AE

- Add TS and AE descriptors in ./descriptor folder, run JCASGen

- Add <buildPath>descriptor:descriptor</buildPath> to pom (in the ruta-maven-plugin section). ./descriptor folder is configured successfully as part of build path

Issues:

- When using ENGINE aeDescriptor in script, project doesn't run:

Caused by: java.io.FileNotFoundException: class path resource [aeDescriptor.xml] cannot be resolved to URL because it does not exist

- TYPESYSTEM typeSystemDescriptor <- works in editor, but maven pom / task throws an error (no details, assuming name/path can't be resolved)

- UIMAFIT de.miba.TestAnno works (and can be executed in ruta script), but Types/TS missing, so runtime errors.

Any hints or an example project where this works would be highly appreciated! I've uploaded the skeleton to https://github.com/mybyte/ruta-test


Cheers,

Michael



--
Dr. Peter Klügl
Head of Text Mining/Machine Learning

Averbis GmbH
Salzstr. 15
79098 Freiburg
Germany

Fon: +49 761 708 394 0
Fax: +49 761 708 394 10
Email:peter.klu...@averbis.com
Web:https://averbis.com

Headquarters: Freiburg im Breisgau
Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080
Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó

Reply via email to