JAPE中的空间代币概念
我正在尝试一个JAPE代码段,并试图理解空间令牌的概念.
I am trying out a JAPE snippet and trying to understand the concept of Space Token.
Phase: Apple
Input: Token SpaceToken Lookup
Options: control = appelt
Rule: Country
(
{Token.string == "President"}
{SpaceToken}
{Lookup.majorType==location}
):impPersons
此JAPE标注的是美国总统,印度总统,但不标注PresidentIndia或PresidentUSA.如果我在上面的代码中从Input和LHS中删除了Space Token,则此注释将保持不变. 那么,如果使用带空间令牌的令牌而不带空间令牌的令牌都标注相同的元素,则基本区别是什么?
This JAPE is annotating President USA, President India but not PresidentIndia or PresidentUSA. This annotation remains same if I remove Space Token from Input and LHS in the above code. Then if with Space Token without Space Token both annotate the same elements, what is the basic difference?
任何帮助将不胜感激.
如果在Input批注中添加SpaceToken,jape也会考虑这些,否则,jape将忽略它们.
If you add SpaceToken in the Input annotations, jape will consider those as well, if not, jape will ignore them.
例如:
Input: Token, SpaceToken
Rule : {Token}{Token}{Token}
Will not match: Barack Obama President
因为是jape文件,所以
Because for jape the document is
{Token-Barack} {SpaceToken} {Token-Obama} {SpaceToken} {Token-President}.
如果从输入中删除SpaceToken,则jape将仅对令牌起作用,因此文档将为:
If you remove the SpaceToken from the input, jape will only operate on tokens, so the document will be:
{Token-Barack} {Token-Obama} {Token-President}
通常,您添加许多注释,并且文档不是那么平坦",并且规则的LHS试图匹配文档图形的任何部分.
Usually you add many annotations and the document is not that "flat" and the LHS of the rule is trying to match any parts of the document graph.