PhraseMatcherclassv2.0 This feature is new and was introduced in spaCy v2.0
PhraseMatcher lets you efficiently match large terminology lists. While the
Matcher lets you match squences based on lists of token descriptions, the
PhraseMatcher accepts match patterns in the form of
Create the rule-based
|The vocabulary object, which must be shared with the documents the matcher will operate on.|
|int||Maximum length of a phrase pattern to add.|
|returns||The newly constructed object.|
Find all token sequences matching the supplied patterns on the
|The document to match over.|
|returns||list|| A list of |
Match a stream of documents, yielding them in turn.
|iterable||A stream of documents.|
|int||The number of documents to accumulate into a working set.|
|int|| The number of threads with which to work on the buffer in parallel, if the |
|yields||Documents, in order.|
Get the number of rules added to the matcher. Note that this only returns the number of rules (identical with the number of IDs), not the number of individual patterns.
|returns||int||The number of rules.|
Check whether the matcher contains rules for a match ID.
|unicode||The match ID.|
|returns||int||Whether the matcher contains rules for this match ID.|
Add a rule to the matcher, consisting of an ID key, one or more patterns, and
a callback function to act on the matches. The callback function will receive the arguments
matches. If a pattern already exists for the given ID, the patterns will be extended. An
on_match callback will be overwritten.
|unicode||An ID for the thing you're matching.|
|callable or || Callback function to act on matches. Takes the arguments |