From 14c4da547f483d6fa6a741e5ea09118775294e71 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 29 Sep 2020 23:08:56 +0200 Subject: [PATCH] Try to fix augmentation --- spacy/training/augment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/training/augment.py b/spacy/training/augment.py index 1756144e6..caa24c054 100644 --- a/spacy/training/augment.py +++ b/spacy/training/augment.py @@ -38,7 +38,10 @@ def orth_variants_augmenter(nlp, example, *, level: float = 0.0, lower: float = orig_dict["token_annotation"], lower=raw_text is not None and random.random() < lower, ) - doc = nlp.make_doc(variant_text) + if variant_text is None: + doc = Doc(nlp.vocab, words=variant_token_annot["words"]) + else: + doc = nlp.make_doc(variant_text) orig_dict["token_annotation"] = variant_token_annot yield example.from_dict(doc, orig_dict)