From 4ff9a837fc837adaaccf8f14e3820d858405a2ed Mon Sep 17 00:00:00 2001 From: Matthw Honnibal Date: Fri, 26 Jun 2020 23:46:18 +0200 Subject: [PATCH] Fix _fix_legacy_dict_data in Example --- spacy/gold/example.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/gold/example.pyx b/spacy/gold/example.pyx index 7f8797043..169965c3d 100644 --- a/spacy/gold/example.pyx +++ b/spacy/gold/example.pyx @@ -336,7 +336,7 @@ def _fix_legacy_dict_data(example_dict): else: raise KeyError(Errors.E983.format(key=key, dict="token_annotation", keys=remapping.keys())) text = example_dict.get("text", example_dict.get("raw")) - if not _has_field(token_dict, "SPACY"): + if _has_field(token_dict, "ORTH") and not _has_field(token_dict, "SPACY"): token_dict["SPACY"] = _guess_spaces(text, token_dict["ORTH"]) if "HEAD" in token_dict and "SENT_START" in token_dict: # If heads are set, we don't also redundantly specify SENT_START.