我试图通过为同一注释创建jape语法规则来提取两个带注释的术语之间的文本。我指的是“ https://gate.ac.uk/wiki/jape-repository/annotations.html#section-2”。此文档具有相同功能,但无法做到。
Phase: DATA
Input: Token
Options: control = appelt
Rule: GuessProduct1
Priority: 4
(
({Token.string == "abc"}):left
({{Token.string == "xyz"}):right
)
-->
{
Node start = ((AnnotationSet) bindings.get("left")).lastNode();
Node end = ((AnnotationSet) bindings.get("right")).firstNode();
FeatureMap features = Factory.newFeatureMap();
features.put("rule", "GuessProduct1");
outputAS.add(start, end,"Product", features);
}