From 77609588b6d39bf4e57ba5ea1fdf94c7490f0fe2 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 25 Apr 2016 19:39:19 +0000 Subject: [PATCH] * Fix assignment of root label to words left as root implicitly, after parsing ends. --- spacy/syntax/arc_eager.pyx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/syntax/arc_eager.pyx b/spacy/syntax/arc_eager.pyx index 7213fbbf7..3f2bc7c65 100644 --- a/spacy/syntax/arc_eager.pyx +++ b/spacy/syntax/arc_eager.pyx @@ -378,7 +378,10 @@ cdef class ArcEager(TransitionSystem): st.fast_forward() cdef int finalize_state(self, StateC* st) nogil: - pass + cdef int i + for i in range(st.length): + if st._sent[i].head == 0 and st._sent[i].dep == 0: + st._sent[i].dep = self.root_label cdef int set_valid(self, int* output, const StateC* st) nogil: cdef bint[N_MOVES] is_valid