Fix dep model loading in parser

This commit is contained in:
Matthew Honnibal 2016-10-12 20:26:38 +02:00
parent d9ae2d68af
commit 41f88ce938
1 changed files with 4 additions and 4 deletions

View File

@ -100,8 +100,8 @@ class BaseDefaults(object):
return Tagger.blank(vocab, Tagger.default_templates()) return Tagger.blank(vocab, Tagger.default_templates())
def Parser(self, vocab, **cfg): def Parser(self, vocab, **cfg):
if self.path and (self.path / 'dep').exists(): if self.path and (self.path / 'deps').exists():
return Parser.load(self.path / 'dep', vocab, ArcEager) return Parser.load(self.path / 'deps', vocab, ArcEager)
else: else:
if 'features' not in cfg: if 'features' not in cfg:
cfg['features'] = self.parser_features cfg['features'] = self.parser_features
@ -204,7 +204,7 @@ class Language(object):
if isinstance(path, basestring): if isinstance(path, basestring):
path = pathlib.Path(path) path = pathlib.Path(path)
tagger_cfg, parser_cfg, entity_cfg = configs tagger_cfg, parser_cfg, entity_cfg = configs
dep_model_dir = path / 'dep' dep_model_dir = path / 'deps'
ner_model_dir = path / 'ner' ner_model_dir = path / 'ner'
pos_model_dir = path / 'pos' pos_model_dir = path / 'pos'
if dep_model_dir.exists(): if dep_model_dir.exists():
@ -376,7 +376,7 @@ class Language(object):
self.tagger.model.dump(str(path / 'pos' / 'model')) self.tagger.model.dump(str(path / 'pos' / 'model'))
if self.parser: if self.parser:
self.parser.model.end_training() self.parser.model.end_training()
self.parser.model.dump(str(path / 'dep' / 'model')) self.parser.model.dump(str(path / 'deps' / 'model'))
if self.entity: if self.entity:
self.entity.model.end_training() self.entity.model.end_training()
self.entity.model.dump(str(path / 'ner' / 'model')) self.entity.model.dump(str(path / 'ner' / 'model'))