You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation for PhraseMatcher should be more explicit about how to pass in a list to PhraseMatcher.add().
The documentation specifies the type of the 3rd parameter as *docs or List, which is a bit misleading. *docs is technically correct, but the add() method actually fails when providing a list of Doc objects with the error:
File "phrasematcher.pyx", line 193, in spacy.matcher.phrasematcher.PhraseMatcher.add
TypeError: an integer is required
Which does not indicate a list cannot be passed. Perhaps it should be more explicit in the example? I lost my morning to this, so I figured I'd make this issue just in case anyone else has the same problem.
Thanks for the detailed report! And yes, I agree – the type Doc would be more appropriate. Fixing!
(On a related note, I can't wait to finally overhaul the {Phrase}Matcher.add methods for spaCy v3). add(str, List[Doc], on_match=None, **kwargs) is a lot more intuitive.
Thanks Ines, much appreciated! I ended up building spaCy from source trying to figure this out 😐, so maybe I'll actually be able to contribute to v3 now!
The documentation for
PhraseMatcher
should be more explicit about how to pass in a list toPhraseMatcher.add()
.The documentation specifies the type of the 3rd parameter as
*docs
orList
, which is a bit misleading.*docs
is technically correct, but theadd()
method actually fails when providing a list ofDoc
objects with the error:Which does not indicate a list cannot be passed. Perhaps it should be more explicit in the example? I lost my morning to this, so I figured I'd make this issue just in case anyone else has the same problem.
Which page or section is this issue related to?
https:/explosion/spaCy/blob/master/website/docs/api/phrasematcher.md
The text was updated successfully, but these errors were encountered: