Create the rule-based Matcher. If validate=True is set, all patterns added
to the matcher will be validated against a JSON schema and a MatchPatternError
is raised if problems are found. Those can include incorrect types (e.g. a
string where an integer is expected) or unexpected property names.
The vocabulary object, which must be shared with the documents the matcher will operate on.
Match a stream of documents, yielding them in turn.
A stream of documents.
The number of documents to accumulate into a working set.
Yield the match lists along with the docs, making results (doc, matches) tuples.
Interpret the input stream as (doc, context) tuples, and yield (result, context) tuples out. If both return_matches and as_tuples are True, the output will be a sequence of ((doc, matches), context) tuples.
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 matcher, doc, i and matches. If a pattern already exists for
the given ID, the patterns will be extended. An on_match callback will be
An ID for the thing you’re matching.
callable or None
Callback function to act on matches. Takes the arguments matcher, doc, i and matches.
Match pattern. A pattern consists of a list of dicts, where each dict describes a token.