HeidelTime:语言参数被指定为 NULL

HeidelTime: Language parameter was specified as NULL

我正在尝试将 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 的独立版本时,我可以在构造函数中指定参数并且它工作正常。

我通过从 GitHub 下载 heideltime-master 并将以下文件夹放入我的 /src/main/resources 文件夹解决了这个问题:

desc.annotator
desc.comsumer
desc.reader
desc.type

之后我像这样创建了 AnalysisEngineDescriptions:

AnalysisEngineDescription heidelTime = createEngineDescriptionFromPath(
            "src/main/resources/desc/annotator/HeidelTime.xml");
            builder.add(heidelTime);

AnalysisEngineDescription intervalTagger = createEngineDescriptionFromPath(
            "src/main/resources/desc/annotator/IntervalTagger.xml");
            builder.add(intervalTagger);

有了这个,我终于让我的管道开始工作了,我可以在 Ruta Workbench.

的 xmi 文件中看到 Timex3 注释