Concept of Space Token in JAPE

雨燕双飞 提交于 2019-12-24 00:58:58

问题


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

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?

Any help will be appreciated.


回答1:


If you add SpaceToken in the Input annotations, jape will consider those as well, if not, jape will ignore them.

For instance:

Input: Token, SpaceToken
Rule : {Token}{Token}{Token}
Will not match: Barack Obama President

Because for jape the document is

{Token-Barack} {SpaceToken} {Token-Obama} {SpaceToken} {Token-President}.

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}

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.



来源:https://stackoverflow.com/questions/38156128/concept-of-space-token-in-jape

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!