diff --git a/bin/parser/train.py b/bin/parser/train.py index aa916d1e0..372c7932e 100755 --- a/bin/parser/train.py +++ b/bin/parser/train.py @@ -111,8 +111,6 @@ def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic', gold_tuples = gold_tuples[:n_sents] nlp = Language(data_dir=model_dir, tagger=False, parser=False, entity=False) - if nlp.lang == 'de': - nlp.vocab.morphology.lemmatizer = lambda string,pos: set([string]) nlp.tagger = Tagger.blank(nlp.vocab, Tagger.default_templates()) nlp.parser = Parser.from_dir(dep_model_dir, nlp.vocab.strings, ArcEager) nlp.entity = Parser.from_dir(ner_model_dir, nlp.vocab.strings, BiluoPushDown) diff --git a/spacy/de/__init__.py b/spacy/de/__init__.py index 76817ccff..8a2f809ff 100644 --- a/spacy/de/__init__.py +++ b/spacy/de/__init__.py @@ -7,3 +7,11 @@ from ..language import Language class German(Language): lang = 'de' + + @classmethod + def default_vocab(cls, package, get_lex_attr=None, vectors_package=None): + vocab = super(German,cls).default_vocab(package,get_lex_attr,vectors_package) + # set a dummy lemmatizer for now that simply returns the same string + # until the morphology is done for German + vocab.morphology.lemmatizer = lambda string,pos: set([string]) + return vocab