spaCy/spacy/tests/matcher
Adriane Boyd 45c9a68828
Identify final Matcher pattern node by quantifier (#6317)
Modify the internal pattern representation in `Matcher` patterns to
identify the final ID state using a unique quantifier rather than a
combination of other attributes.

It was insufficient to identify the final ID node based on an
uninitialized `quantifier` (coincidentally being the same as the `ZERO`)
with `nr_attr` as 0. (In addition, it was potentially bug-prone that
`nr_attr` was set to 0 even though attrs were allocated.)

In the case of `{"OP": "!"}` (a valid, if pointless, pattern), `nr_attr`
is 0 and the quantifier is ZERO, so the previous methods for
incrementing to the ID node at the end of the pattern weren't able to
distinguish the final ID node from the `{"OP": "!"}` pattern.
2020-10-31 12:18:48 +01:00
..
__init__.py Revert #4334 2019-09-29 17:32:12 +02:00
test_matcher_api.py Identify final Matcher pattern node by quantifier (#6317) 2020-10-31 12:18:48 +01:00
test_matcher_logic.py Implement new API for {Phrase}Matcher.add (backwards-compatible) (#4522) 2019-10-25 22:21:08 +02:00
test_pattern_validation.py Add warning when Matcher subpattern is discarded (#5873) 2020-08-05 14:56:14 +02:00
test_phrase_matcher.py Switch to new add API in PhraseMatcher unpickle 2020-05-25 11:22:47 +02:00