我正在尝试使用以下代码从UIMAFIT简单管道运行现有的UIMA Ruta分析引擎:

File specFile = new File("MyEngine.xml");
XMLInputSource in = new XMLInputSource(specFile);
ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
AnalysisEngineDescription aed = (AnalysisEngineDescription) specifier;
builder.add(aed); // Builder is an aggregateBuilder

运行它后,它将解析从引擎的主脚本(Cleartk Stanford工具)导入的内容,然后退出,但出现以下异常:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.uima.ruta.type.RutaBasic.setLowMemoryProfile(Z)V
at org.apache.uima.ruta.RutaStream.initalizeBasics(RutaStream.java:173)
at org.apache.uima.ruta.engine.RutaEngine.initializeStream(RutaEngine.java:575)
at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:432)
at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:378)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:298)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:568)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:410)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:343)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:265)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:568)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:410)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:343)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:265)
at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
at org.uimafit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:80)
at org.myproject.workflow.ParagraphAnnotationPipeline.main(ParagraphAnnotationPipeline.java:107)

该引擎是使用Ruta 2.2.0的预发行版创建的,并且管道使用UIMAFIT 2.0.0和使用maven导入的Ruta-core 2.1.0在UIMA 2.5.0中运行。

谢谢你的帮助!

最佳答案

此问题很可能是由于JCas类被覆盖这一事实引起的。 UIMA Ruta提供了一些为种子,推理和其他分析引擎定义的类型的JCas类。其中一种(至少,但最重要)包含用于存储有关批注和更多信息的其他方法:RutaBasic。这些JCas类不能被覆盖。

自述文件中针对应用JCasGenPomFriendly的用户进行了提及:

If you use the uimaFIT JCasGenPomFriendly in Maven and want to use UIMA Ruta
as a standalone annotator you have to exclude the generated UIMA Ruta basic
type files from the build, e.g., by adding:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.0</version>
  <configuration>
     <excludes>
         <exclude>org/apache/uima/ruta/type/*.java</exclude>
     </excludes>
  </configuration>
</plugin>

您能否检查您是否生成了RutaBasic,并且该类是否包含例如setLowMemoryProfile方法。

10-07 21:04