Merge pull request #358 from wbwseeker/german_lemmatizer_dummy

German lemmatizer dummy
This commit is contained in:
Matthew Honnibal 2016-05-03 07:38:26 +10:00
commit 377a624046
2 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -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