mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Update docstrings
This commit is contained in:
parent
463e3cc80f
commit
790435e51c
|
@ -206,21 +206,15 @@ cdef class Matcher:
|
||||||
|
|
||||||
def add(self, key, on_match, *patterns):
|
def add(self, key, on_match, *patterns):
|
||||||
"""Add a match-rule to the matcher.
|
"""Add a match-rule to the matcher.
|
||||||
|
A match-rule consists of: an ID key, an on_match callback, and one or
|
||||||
A match-rule consists of: an ID key, an on_match callback,
|
more patterns. If the key exists, the patterns are appended to the
|
||||||
and one or more patterns. If the key exists, the patterns
|
previous ones, and the previous on_match callback is replaced. The
|
||||||
are appended to the previous ones, and the previous on_match
|
`on_match` callback will receive the arguments `(matcher, doc, i, matches)`.
|
||||||
callback is replaced.
|
Note that if no `on_match` callback is specified, the document will not
|
||||||
|
be modified. A pattern consists of one or more `token_specs`, where a
|
||||||
The on_match callback will receive the arguments
|
`token_spec` is a dictionary mapping attribute IDs to values. Token
|
||||||
(matcher, doc, i, matches). Note that if no `on_match`
|
descriptors can also include quantifiers. There are currently important
|
||||||
callback is specified, the document will not be modified.
|
known problems with the quantifiers – see the docs.
|
||||||
|
|
||||||
A pattern consists of one or more token_specs,
|
|
||||||
where a token_spec is a dictionary mapping
|
|
||||||
attribute IDs to values. Token descriptors can also
|
|
||||||
include quantifiers. There are currently important
|
|
||||||
known problems with the quantifiers --- see the docs.
|
|
||||||
"""
|
"""
|
||||||
for pattern in patterns:
|
for pattern in patterns:
|
||||||
if len(pattern) == 0:
|
if len(pattern) == 0:
|
||||||
|
@ -238,7 +232,6 @@ cdef class Matcher:
|
||||||
|
|
||||||
def remove(self, key):
|
def remove(self, key):
|
||||||
"""Remove a rule from the matcher.
|
"""Remove a rule from the matcher.
|
||||||
|
|
||||||
A KeyError is raised if the key does not exist.
|
A KeyError is raised if the key does not exist.
|
||||||
"""
|
"""
|
||||||
key = self._normalize_key(key)
|
key = self._normalize_key(key)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user