Closed sam-writer closed 4 years ago
this really isn't useful unless we can say "if the optional token match happened, use it here", e.g.
"patterns": [
{
"POS": "DET",
"OP": "?"
},
{
"LOWER": {
"IN": [
"some",
"list"
]
}
},
{
"POS": "NOUN"
}
]
would want to say
"suggestions": [
[
{
"PATTERN_REF": 0,
"OP": "?"
},
{
"PATTERN_REF": -1
},
{
"TEXT": "with"
},
{
"PATTERN_REF": -2
}
]
],
Meaning, copy the first token if it matched... which AFAICT is hard
Closing this, optional matches is a different, harder problem.
If there are optional tokens in your spacy match pattern, and you want to reference the last token in your suggestion, you currently cannot do this. It should be possible, however, to do this, by checking to see if the token is negative and then referencing
end
instead ofstart
in this line