From 70d2acb5795a975b80e05f17b1e76c1aad3ecfbb Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 9 Jul 2015 12:15:01 +0200 Subject: [PATCH] * Fix edge features --- spacy/syntax/stateclass.pyx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spacy/syntax/stateclass.pyx b/spacy/syntax/stateclass.pyx index 038059f94..c4a41ff73 100644 --- a/spacy/syntax/stateclass.pyx +++ b/spacy/syntax/stateclass.pyx @@ -20,6 +20,9 @@ cdef class StateClass: for i in range(length, length + (PADDING * 2)): self._sent[i].lex = &EMPTY_LEXEME self._sent += PADDING + for i in range(length): + self._sent[i].l_edge = i + self._sent[i].r_edge = i self._ents += PADDING self._buffer += PADDING self._stack += PADDING @@ -153,10 +156,10 @@ cdef class StateClass: cdef TokenC* h = &self._sent[h_i] if c_i > h_i: h.r_kids -= 1 - h.r_edge = self.R_(h_i, h.r_kids-1).r_edge if h.r_kids >= 1 else h_i + h.r_edge = self.R_(h_i, 2).r_edge if h.r_kids >= 1 else h_i else: h.l_kids -= 1 - h.l_edge = self.L_(h_i, h.l_kids-1).l_edge if h.l_kids >= 1 else h_i + h.l_edge = self.L_(h_i, 2).l_edge if h.l_kids >= 1 else h_i cdef void open_ent(self, int label) nogil: self._ents[self._e_i].start = self.B(0)