【发布时间】:2018-05-09 19:42:55
【问题描述】:
我正在尝试在句子注释中获取现有注释及其特征,即对于每个句子,可能有多个注释,它们具有主要类型、字符串和类型特征。
我想要一个新的“句子包含”注释,其中包含注释及其各自特征的特征图。
我相信它应该是优秀 Gate Jape 语法教程 pdf 中以下规则的扩展:
Phase:usingJAVAinRHS
Input: Lookup
Options: control = all
Rule: javainRHS1
(
{Lookup.majorType == Team}
)
:team
-->
{
gate.AnnotationSet team = (gate.AnnotationSet)bindings.get("team");
gate.Annotation teamAnn = (gate.Annotation)team.iterator().next();
gate.FeatureMap features = Factory.newFeatureMap();
features.put("teamOfSport", teamAnn.getFeatures().get("minorType"));
features.put("rule","javainRHS1");
outputAS.add(team.firstNode(), team.lastNode(), "Team",features); }
除了在我的新规则中,我想对句子进行注释,然后获取包含的注释:
Phase:usingJAVAinRHS
Input: Lookup Sentence
Options: control = all
Rule: javainRHS1
(
{Sentence contains {Lookup.majorType == Team}}
)
:team
-->
{
gate.AnnotationSet team = (gate.AnnotationSet)bindings.get("team");
gate.Annotation teamAnn = (gate.Annotation)team.iterator().next();
gate.FeatureMap features = Factory.newFeatureMap();
features.put("teamOfSport", teamAnn.getFeatures().get("minorType"));
features.put("rule","javainRHS1");
outputAS.add(team.firstNode(), team.lastNode(), "Team",features); }
如何获取包含注释的特征图?
非常感谢
【问题讨论】: