* Bug fixes to edge calculation

This commit is contained in:
Matthew Honnibal 2015-06-24 04:28:02 +02:00
parent 7f9384f53c
commit 02b171ee67

View File

@ -193,11 +193,13 @@ cdef class StateClass:
cdef int i
if child > head:
self._sent[head].r_kids += 1
self._sent[head].r_edge = child
# Some transition systems can have a word in the buffer have a
# rightward child, e.g. from Unshift.
self._sent[head].r_edge = self._sent[child].r_edge
i = 0
while self.has_head(head) and i < self.length:
self._sent[head].r_edge = child
head = self.H(head)
self._sent[head].r_edge = self._sent[child].r_edge
i += 1 # Guard against infinite loops
else:
self._sent[head].l_kids += 1