问题
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