From 0c93c73e496f9c57da523393e33a6f88aa3eac25 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 20 Sep 2017 22:26:40 +0200 Subject: [PATCH] Add __reduce__ method for PhraseMatcher --- spacy/matcher.pyx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spacy/matcher.pyx b/spacy/matcher.pyx index ba3559966..ef4044d21 100644 --- a/spacy/matcher.pyx +++ b/spacy/matcher.pyx @@ -422,6 +422,7 @@ cdef class PhraseMatcher: cdef attr_t* _phrase_key cdef public object _callbacks + cdef public object _patterns def __init__(self, Vocab vocab, max_length=10): self.mem = Pool() @@ -436,6 +437,9 @@ cdef class PhraseMatcher: self.matcher.add('Candidate', None, *abstract_patterns) self._callbacks = {} + def __reduce__(self): + return (self.__class__, (self.vocab,), None, None) + def add(self, key, on_match, *docs): cdef Doc doc for doc in docs: