spaCy/spacy/matcher
Paul O'Leary McCann 77d698dcae
Fix check for RIGHT_ATTRS in dep matcher (#8807)
* Fix check for RIGHT_ATTRs in dep matcher

If a non-anchor node does not have RIGHT_ATTRS, the dep matcher throws
an E100, which says that non-anchor nodes must have LEFT_ID, REL_OP, and
RIGHT_ID. It specifically does not say RIGHT_ATTRS is required.

A blank RIGHT_ATTRS is also valid, and patterns with one will be
excepted. While not normal, sometimes a REL_OP is enough to specify a
non-anchor node - maybe you just want the head of another node
unconditionally, for example.

This change just sets RIGHT_ATTRS to {} if not present. Alternatively
changing E100 to state RIGHT_ATTRS is required could also be reasonable.

* Fix test

This test was written on the assumption that if `RIGHT_ATTRS` isn't
present an error will be raised. Since the proposed changes make it so
an error won't be raised this is no longer necessary.

* Revert test, update error message

Error message now lists missing keys, and RIGHT_ATTRS is required.

* Use list of required keys in error message

Also removes unused key param arg.
2021-08-04 09:20:41 +02:00
..
__init__.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
dependencymatcher.pyx Fix check for RIGHT_ATTRS in dep matcher (#8807) 2021-08-04 09:20:41 +02:00
matcher.pxd Support match alignments (#7321) 2021-04-08 18:10:14 +10:00
matcher.pyx Support list values and INTERSECTS in Matcher (#8784) 2021-08-02 19:39:26 +02:00
phrasematcher.pxd Run PhraseMatcher on Spans (#6918) 2021-02-10 23:43:32 +11:00
phrasematcher.pyx Don't add duplicate patterns all the time in EntityRuler (fix #8216) (#8246) 2021-06-03 09:05:26 +02:00