From 4f0843e0ec5646508adb7758bf11b32d2ebd8995 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Thu, 30 Jul 2020 14:45:43 +0200 Subject: [PATCH] Sort spans before processing --- spacy/pipeline/attributeruler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/pipeline/attributeruler.py b/spacy/pipeline/attributeruler.py index 706873290..1d41e6270 100644 --- a/spacy/pipeline/attributeruler.py +++ b/spacy/pipeline/attributeruler.py @@ -88,7 +88,7 @@ class AttributeRuler(Pipe): # Retokenize with each set of disjoint spans separately for span_set in disjoint_span_sets: with doc.retokenize() as retokenizer: - for span in span_set: + for span in sorted(span_set): attrs = self.attrs[span.label] index = self.indices[span.label] token = span[index]