reorder so tagmap is replaced only if a custom file is provided. (#6164)

* reorder so tagmap is replaced only if a custom file is provided.

* Remove unneeded variable initialization

Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
This commit is contained in:
Elijah Rippeth 2020-09-30 07:26:06 -04:00 committed by GitHub
parent 27c5795ea5
commit 4cbb954281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,10 +59,6 @@ def debug_data(
if not dev_path.exists():
msg.fail("Development data not found", dev_path, exits=1)
tag_map = {}
if tag_map_path is not None:
tag_map = srsly.read_json(tag_map_path)
# Initialize the model and pipeline
pipeline = [p.strip() for p in pipeline.split(",")]
if base_model:
@ -70,8 +66,11 @@ def debug_data(
else:
lang_cls = get_lang_class(lang)
nlp = lang_cls()
# Replace tag map with provided mapping
nlp.vocab.morphology.load_tag_map(tag_map)
if tag_map_path is not None:
tag_map = srsly.read_json(tag_map_path)
# Replace tag map with provided mapping
nlp.vocab.morphology.load_tag_map(tag_map)
msg.divider("Data format validation")