From 5cf3eeee0d4cd3906c94dacb1382cf4c0c149f89 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Tue, 23 Jun 2020 14:49:31 +0200 Subject: [PATCH] bugfix: update states after creating golds to avoid out of bounds indexing --- spacy/syntax/arc_eager.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/syntax/arc_eager.pyx b/spacy/syntax/arc_eager.pyx index 28787f97d..b57c4f312 100644 --- a/spacy/syntax/arc_eager.pyx +++ b/spacy/syntax/arc_eager.pyx @@ -615,8 +615,8 @@ cdef class ArcEager(TransitionSystem): def init_gold_batch(self, examples): states = self.init_batch([eg.predicted for eg in examples]) keeps = [i for i, s in enumerate(states) if not s.is_final()] - states = [states[i] for i in keeps] golds = [ArcEagerGold(self, states[i], examples[i]) for i in keeps] + states = [states[i] for i in keeps] for gold in golds: self._replace_unseen_labels(gold) n_steps = sum([len(s.queue) * 4 for s in states])