mirror of
https://github.com/explosion/spaCy.git
synced 2025-05-29 10:13:19 +03:00
Add __reduce__ method for PhraseMatcher
This commit is contained in:
parent
cc408fc189
commit
0c93c73e49
|
@ -422,6 +422,7 @@ cdef class PhraseMatcher:
|
||||||
cdef attr_t* _phrase_key
|
cdef attr_t* _phrase_key
|
||||||
|
|
||||||
cdef public object _callbacks
|
cdef public object _callbacks
|
||||||
|
cdef public object _patterns
|
||||||
|
|
||||||
def __init__(self, Vocab vocab, max_length=10):
|
def __init__(self, Vocab vocab, max_length=10):
|
||||||
self.mem = Pool()
|
self.mem = Pool()
|
||||||
|
@ -436,6 +437,9 @@ cdef class PhraseMatcher:
|
||||||
self.matcher.add('Candidate', None, *abstract_patterns)
|
self.matcher.add('Candidate', None, *abstract_patterns)
|
||||||
self._callbacks = {}
|
self._callbacks = {}
|
||||||
|
|
||||||
|
def __reduce__(self):
|
||||||
|
return (self.__class__, (self.vocab,), None, None)
|
||||||
|
|
||||||
def add(self, key, on_match, *docs):
|
def add(self, key, on_match, *docs):
|
||||||
cdef Doc doc
|
cdef Doc doc
|
||||||
for doc in docs:
|
for doc in docs:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user