Add __reduce__ methods on parser subclasses. Fixes pickling.
@@ -335,6 +335,9 @@ cdef class NeuralDependencyParser(NeuralParser):
name = 'parser'
TransitionSystem = ArcEager
+ def __reduce__(self):
+ return (NeuralDependencyParser, (self.vocab, self.moves, self.model), None, None)
+
cdef class NeuralEntityRecognizer(NeuralParser):
name = 'entity'
@@ -342,6 +345,10 @@ cdef class NeuralEntityRecognizer(NeuralParser):
nr_feature = 6
+ def __reduce__(self):
+ return (NeuralEntityRecognizer, (self.vocab, self.moves, self.model), None, None)
+
+
cdef class BeamDependencyParser(BeamParser):
TransitionSystem = ArcEager
