我正在尝试将 HeidelTime 包含到我的 uimaFIT-Pipeline 中。
这是我的管道:
AggregateBuilder builder = new AggregateBuilder();
CollectionReaderDescription reader = createReaderDescription(TextReader.class,
TextReader.PARAM_SOURCE_LOCATION, dateTimePath, TextReader.PARAM_LANGUAGE, "en",
TextReader.PARAM_PATTERNS, "*.txt");
AnalysisEngineDescription treeTagger = createEngineDescription(TreeTaggerWrapper.class,
TreeTaggerWrapper.PARAM_LANGUAGE, "english",
TreeTaggerWrapper.PARAM_ANNOTATE_PARTOFSPEECH, true,
TreeTaggerWrapper.PARAM_ANNOTATE_SENTENCES, true,
TreeTaggerWrapper.PARAM_ANNOTATE_TOKENS, true);
builder.add(treeTagger);
AnalysisEngineDescription heidelTime = createEngineDescription(HeidelTime.class);
builder.add(heidelTime);
AnalysisEngineDescription intervalTagger = createEngineDescription(IntervalTagger.class);
builder.add(intervalTagger);
AnalysisEngineDescription xmiWriter = createEngineDescription(XmiWriter.class,
XmiWriter.PARAM_TARGET_LOCATION, outputPath,
XmiWriter.PARAM_OVERWRITE, true);
builder.add(xmiWriter);
SimplePipeline.runPipeline(reader, builder.createAggregateDescription());
但是执行时出现以下异常:
Language parameter was specified as NULL.
org.apache.uima.resource.ResourceInitializationException: Initialization of annotator class "de.unihd.dbs.uima.annotator.heideltime.HeidelTime" failed. (Descriptor: <unknown>)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:268)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:175)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:279)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:407)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:256)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:435)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:379)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:192)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:279)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:407)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:256)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:435)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:379)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:192)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:279)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:331)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:448)
at org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:166)
...
Caused by: java.lang.NullPointerException
at de.unihd.dbs.uima.annotator.heideltime.resources.Language.getLanguageFromString(Language.java:65)
at de.unihd.dbs.uima.annotator.heideltime.HeidelTime.initialize(HeidelTime.java:141)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:261)
... 80 more
如何在管道中设置语言和所有其他参数?我还没有找到办法。当我使用 HeidelTime 的独立版本时,我可以在构造函数中指定参数并且它工作正常。