-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
bugBugs and behaviour differing from documentationBugs and behaviour differing from documentation
Description
Hello,
Using spacy PhraseMatcher now gives error due to deprecated use of acceptor keyword in Matcher. Here is a simple example:
import spacy
from spacy.matcher import PhraseMatcher
nlp = spacy.load("en")
MWEs = [u"machine-learning"]
vocab = nlp.tokenizer.vocab
matcher = PhraseMatcher(vocab=vocab, phrases=[], max_length=6)
for mwe in MWEs:
phrase = nlp.tokenizer(mwe)
matcher.add(phrase)
s = u"machine-learning is used for predictive analytics"
doc = nlp(s)
matcher(doc)
It results in:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "spacy/matcher.pyx", line 509, in spacy.matcher.PhraseMatcher.__call__ (spacy/matcher.cpp:11800)
File "spacy/matcher.pyx", line 344, in spacy.matcher.Matcher.__call__ (spacy/matcher.cpp:8013)
ValueError: acceptor keyword argument to Matcher deprecated. Specify acceptor functions when you add patterns instead.
Looking at both class Matcher and PhraseMatcher, the __call__ method of PhraseMatcher calls the __call__ method of Matcher with acceptor=self.accept_match, which seems deprecated.
Your Environment
- Operating System: OSX
- Python Version Used: 2.7.12
- spaCy Version Used: 1.2.0
- Environment Information:
Metadata
Metadata
Assignees
Labels
bugBugs and behaviour differing from documentationBugs and behaviour differing from documentation