From 1d5d9838a29a5aa71b9289cbbd6a2323bdf449ed Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 21 May 2017 17:52:57 -0500 Subject: [PATCH] Fix action collection for parser --- spacy/syntax/arc_eager.pyx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spacy/syntax/arc_eager.pyx b/spacy/syntax/arc_eager.pyx index 9232128ea..6bdaec550 100644 --- a/spacy/syntax/arc_eager.pyx +++ b/spacy/syntax/arc_eager.pyx @@ -324,10 +324,12 @@ cdef class ArcEager(TransitionSystem): if label.upper() != 'ROOT': if (LEFT, label) not in seen_actions: actions[LEFT].append(label) + seen_actions.add((LEFT, label)) for label in kwargs.get('right_labels', []): if label.upper() != 'ROOT': if (RIGHT, label) not in seen_actions: actions[RIGHT].append(label) + seen_actions.add((RIGHT, label)) for raw_text, sents in kwargs.get('gold_parses', []): for (ids, words, tags, heads, labels, iob), ctnts in sents: @@ -338,9 +340,11 @@ cdef class ArcEager(TransitionSystem): if head < child: if (RIGHT, label) not in seen_actions: actions[RIGHT].append(label) + seen_actions.add((RIGHT, label)) elif head > child: if (LEFT, label) not in seen_actions: actions[LEFT].append(label) + seen_actions.add((LEFT, label)) return actions property action_types: