From 847a4a41821c28e2fe2c292445428979f34e2097 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 12 Oct 2016 13:45:58 +0200 Subject: [PATCH] Refactor Language, dropping Language.blank() method. --- spacy/language.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/spacy/language.py b/spacy/language.py index 7cf4c4b4d..d07959aae 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -189,12 +189,6 @@ class Language(object): Defaults = BaseDefaults lang = None - @classmethod - def blank(cls): - return cls(path=False, vocab=False, tokenizer=False, tagger=False, - parser=False, entity=False, matcher=False, serializer=False, - vectors=False, pipeline=False) - @classmethod @contextmanager def train(cls, path, gold_tuples, *configs): @@ -228,11 +222,22 @@ class Language(object): with (pos_model_dir / 'config.json').open('wb') as file_: json.dump(tagger_cfg, file_) - self = cls.blank() - self.path = path - self.vocab = self.defaults.Vocab() + self = cls( + path=path, + vocab=False, + tokenizer=False, + tagger=False, + parser=False, + entity=False, + matcher=False, + serializer=False, + vectors=False, + pipeline=False) + self.defaults.parser_labels = parser_cfg['labels'] self.defaults.entity_labels = entity_cfg['labels'] + + self.vocab = self.defaults.Vocab() self.tokenizer = self.defaults.Tokenizer(self.vocab) self.tagger = self.defaults.Tagger(self.vocab, **tagger_cfg) self.parser = self.defaults.Parser(self.vocab, **parser_cfg)