gpt4 book ai didi

uima - 从 UIMAFIT SimplePipeline 运行 UIMA Ruta 脚本时出现 NoSuchMethodError

转载 作者:行者123 更新时间:2023-12-01 23:59:31 27 4
gpt4 key购买 nike

我正在尝试使用以下代码从 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 的 UIMA 2.5.0 和使用 Maven 导入的 Ruta-core 2.1.0 中运行。

感谢您的帮助!

最佳答案

这个问题很可能是JCas类被覆盖造成的。 UIMA Ruta 提供了一些为播种、推理和其他分析引擎定义的类型的 JCas 类。其中之一(至少,但最重要)包含用于存储有关注释等信息的附加方法:RutaBasic。不得覆盖这些 JCas 类。

README 中为应用 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 方法。

关于uima - 从 UIMAFIT SimplePipeline 运行 UIMA Ruta 脚本时出现 NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22161137/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com