在UIMA Ruta中输入此脚本/块中未定义的“Sentence”

时间:2017-12-13 14:42:37

标签: uima ruta

我正在

  

在此脚本/块中未定义“Sentence”类型!

在“ main.ruta ”中编写“句子”块时出现

错误。

这是我的uima ruta脚本:

PACKAGE com.example.test;
DECLARE ApplyBusinessCardKeyword;
WORDLIST ApplicationKeywordList = 'application.txt';
Sentence{->MARKFAST(ApplyBusinessCardKeyword, ApplicationKeywordList)};

“段落”注释也会发生这种情况。 其他注释如“文档”工作正常。

我可能做错什么的想法?

我使用的是最新的UIMA Workbench(2.6.1)和Runtime(2.10.2)。

这是完整的错误堆栈:

Dec 13, 2017 5:02:25 PM org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl callAnalysisComponentProcess(434)
SEVERE: Exception occurred
org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator processing failed.    
    at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:563)
    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:401)
    at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:318)
    at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:269)
    at org.apache.uima.ruta.ide.launching.RutaLauncher.processFile(RutaLauncher.java:242)
    at org.apache.uima.ruta.ide.launching.RutaLauncher.main(RutaLauncher.java:191)
Caused by: java.lang.IllegalArgumentException: Not able to resolve annotation/type expression: Sentence
    at org.apache.uima.ruta.expression.MatchReference.resolve(MatchReference.java:132)
    at org.apache.uima.ruta.expression.MatchReference.getAnnotationExpression(MatchReference.java:173)
    at org.apache.uima.ruta.expression.AnnotationTypeExpression.initialize(AnnotationTypeExpression.java:59)
    at org.apache.uima.ruta.expression.AnnotationTypeExpression.getType(AnnotationTypeExpression.java:152)
    at org.apache.uima.ruta.rule.RutaAnnotationTypeMatcher.getMatchingAnnotations(RutaAnnotationTypeMatcher.java:55)
    at org.apache.uima.ruta.rule.RutaRuleElement.getAnchors(RutaRuleElement.java:51)
    at org.apache.uima.ruta.rule.RutaRuleElement.startMatch(RutaRuleElement.java:59)
    at org.apache.uima.ruta.rule.ComposedRuleElement.startMatch(ComposedRuleElement.java:76)
    at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:63)
    at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:54)
    at org.apache.uima.ruta.rule.RutaRule.apply(RutaRule.java:36)
    at org.apache.uima.ruta.block.RutaScriptBlock.apply(RutaScriptBlock.java:67)
    at org.apache.uima.ruta.RutaModule.apply(RutaModule.java:56)
    at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:561)
    ... 6 more

1 个答案:

答案 0 :(得分:2)

据我所知,你需要创建自己的规则来注释句子和段落,而从你的例子中你不会这样做。

从文档https://uima.apache.org/d/ruta-current/tools.ruta.book.html#ugr.tools.ruta.language.seeding中查看此链接,其中包含RUTA引擎的基本注释

这个创建句子的例子来自文档

DECLARE Sentence; PERIOD #{-> MARK(Sentence)} PERIOD;

对于段落来说它有点棘手,如果您检查了文档,您会注意到它们使用了一些属性来检查它(例如粗体),您需要创建自己的规则来查找它们