mirror of https://github.com/explosion/spaCy.git
Fix serialization when empty parser model. Closes #2482
This commit is contained in:
parent
d5a6c63b62
commit
f82f8ba5dd
|
@ -531,7 +531,7 @@ cdef class Parser:
|
|||
|
||||
def to_disk(self, path, **exclude):
|
||||
serializers = {
|
||||
'model': lambda p: self.model.to_disk(p),
|
||||
'model': lambda p: (self.model.to_disk(p) if self.model is not True else True),
|
||||
'vocab': lambda p: self.vocab.to_disk(p),
|
||||
'moves': lambda p: self.moves.to_disk(p, strings=False),
|
||||
'cfg': lambda p: p.open('w').write(json_dumps(self.cfg))
|
||||
|
@ -560,7 +560,7 @@ cdef class Parser:
|
|||
|
||||
def to_bytes(self, **exclude):
|
||||
serializers = OrderedDict((
|
||||
('model', lambda: self.model.to_bytes()),
|
||||
('model', lambda: (self.model.to_bytes() if self.model is not True else True)),
|
||||
('vocab', lambda: self.vocab.to_bytes()),
|
||||
('moves', lambda: self.moves.to_bytes(strings=False)),
|
||||
('cfg', lambda: json.dumps(self.cfg, indent=2, sort_keys=True))
|
||||
|
|
Loading…
Reference in New Issue