Fix attributeruler key

This commit is contained in:
Matthew Honnibal 2020-09-25 23:20:50 +02:00
parent 092ce4648e
commit 98327f66a9

View File

@ -173,7 +173,9 @@ class AttributeRuler(Pipe):
DOCS: https://nightly.spacy.io/api/attributeruler#add
"""
self.matcher.add(len(self.attrs), patterns)
# This needs to be a string, because otherwise it's interpreted as a
# string key.
self.matcher.add(f"attr_rules_{len(self.attrs)}", patterns)
self._attrs_unnormed.append(attrs)
attrs = normalize_token_attrs(self.vocab, attrs)
self.attrs.append(attrs)