Fixes for morphologizer

This commit is contained in:
Matthew Honnibal 2019-03-09 00:20:11 +00:00
parent afa227e25b
commit c4df89ab90
1 changed files with 2 additions and 2 deletions

View File

@ -304,7 +304,7 @@ def get_token_conllu(token, i):
replacements = {"one": "1", "two": "2", "three": "3"}
for feat in features:
if not feat.startswith("begin") and not feat.startswith("end"):
key, value = feat.split("_")
key, value = feat.split("_", 1)
value = replacements.get(value, value)
feat_str.append("%s=%s" % (key, value.title()))
if not feat_str:
@ -342,7 +342,7 @@ def load_nlp(corpus, config, vectors=None):
def initialize_pipeline(nlp, docs, golds, config, device):
nlp.add_pipe(nlp.create_pipe("tagger", set_morphology=False))
nlp.add_pipe(nlp.create_pipe("tagger", config={"set_morphology": False}))
nlp.add_pipe(nlp.create_pipe("morphologizer"))
nlp.add_pipe(nlp.create_pipe("parser"))
assert not nlp.get_pipe("tagger").set_morphology