mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Merge pull request #358 from wbwseeker/german_lemmatizer_dummy
German lemmatizer dummy
This commit is contained in:
commit
377a624046
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user