在 UIMA Ruta 中输入 "Sentence" not defined in this script/block
Type "Sentence" not defined in this script/block in UIMA Ruta
我得到一个
Type "Sentence" not defined in this script/block!
在“main.ruta”中写入“Sentence”块时出错。
这是我的 uima ruta 脚本:
PACKAGE com.example.test;
DECLARE ApplyBusinessCardKeyword;
WORDLIST ApplicationKeywordList = 'application.txt';
Sentence{->MARKFAST(ApplyBusinessCardKeyword, ApplicationKeywordList)};
"Paragraph" 注释也会发生这种情况。
"Document" 等其他注释工作正常。
关于我可能做错了什么的想法?
我正在使用最新的 UIMA Workbench (2.6.1) 和运行时 (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
据我所知,您需要创建自己的规则来注释句子和段落,而从您的示例来看,您并没有这样做。
从文档中查看此 link https://uima.apache.org/d/ruta-current/tools.ruta.book.html#ugr.tools.ruta.language.seeding 它包含 RUTA 引擎的基本注释
这个创建句子的例子取自文档
DECLARE Sentence;
PERIOD #{-> MARK(Sentence)} PERIOD;
对于段落来说有点棘手,如果你查看文档你会注意到他们使用一些属性来检查它(例如粗体),你需要创建自己的规则来找到注释它们
我知道这是一个非常古老的 Q,但是除了创建您自己的 Q 之外还有一种替代方法,您可以加载并使用第三方注释器来为您完成。
IMPORT PACKAGE de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos
FROM desc.type.POS AS pos;
IMPORT de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token
FROM desc.type.LexicalUnits_customized AS token;
IMPORT de.tudarmstadt.ukp.dkpro.core.api.metadata.type.TagsetDescription
FROM desc.type.metadata;
UIMAFIT de.tudarmstadt.ukp.dkpro.core.opennlp.OpenNlpSegmenter;
UIMAFIT de.tudarmstadt.ukp.dkpro.core.tokit.ParagraphSplitter;
UIMAFIT de.tudarmstadt.ukp.dkpro.core.opennlp.OpenNlpPosTagger;
uima.tcas.DocumentAnnotation{-CONTAINS(pos.POS)} -> {
uima.tcas.DocumentAnnotation{-> SETFEATURE("language", "en")};
EXEC(OpenNlpSegmenter);
EXEC(ParagraphSplitter);
EXEC(OpenNlpPosTagger);
};
我得到一个
Type "Sentence" not defined in this script/block!
在“main.ruta”中写入“Sentence”块时出错。
这是我的 uima ruta 脚本:
PACKAGE com.example.test;
DECLARE ApplyBusinessCardKeyword;
WORDLIST ApplicationKeywordList = 'application.txt';
Sentence{->MARKFAST(ApplyBusinessCardKeyword, ApplicationKeywordList)};
"Paragraph" 注释也会发生这种情况。 "Document" 等其他注释工作正常。
关于我可能做错了什么的想法?
我正在使用最新的 UIMA Workbench (2.6.1) 和运行时 (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
据我所知,您需要创建自己的规则来注释句子和段落,而从您的示例来看,您并没有这样做。
从文档中查看此 link https://uima.apache.org/d/ruta-current/tools.ruta.book.html#ugr.tools.ruta.language.seeding 它包含 RUTA 引擎的基本注释
这个创建句子的例子取自文档
DECLARE Sentence;
PERIOD #{-> MARK(Sentence)} PERIOD;
对于段落来说有点棘手,如果你查看文档你会注意到他们使用一些属性来检查它(例如粗体),你需要创建自己的规则来找到注释它们
我知道这是一个非常古老的 Q,但是除了创建您自己的 Q 之外还有一种替代方法,您可以加载并使用第三方注释器来为您完成。
IMPORT PACKAGE de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos
FROM desc.type.POS AS pos;
IMPORT de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token
FROM desc.type.LexicalUnits_customized AS token;
IMPORT de.tudarmstadt.ukp.dkpro.core.api.metadata.type.TagsetDescription
FROM desc.type.metadata;
UIMAFIT de.tudarmstadt.ukp.dkpro.core.opennlp.OpenNlpSegmenter;
UIMAFIT de.tudarmstadt.ukp.dkpro.core.tokit.ParagraphSplitter;
UIMAFIT de.tudarmstadt.ukp.dkpro.core.opennlp.OpenNlpPosTagger;
uima.tcas.DocumentAnnotation{-CONTAINS(pos.POS)} -> {
uima.tcas.DocumentAnnotation{-> SETFEATURE("language", "en")};
EXEC(OpenNlpSegmenter);
EXEC(ParagraphSplitter);
EXEC(OpenNlpPosTagger);
};