* Fix bounds checking on entities

This commit is contained in:
Matthew Honnibal 2015-06-23 04:35:08 +02:00
parent 43ef5ddea5
commit ee3e56f27b
1 changed files with 7 additions and 8 deletions

View File

@ -35,9 +35,9 @@ cdef class StateClass:
cdef int E(self, int i) nogil:
if self._e_i <= 0 or self._e_i >= self.length:
return -1
if i <= 0 or i >= self.length:
return -1
return 0
if i < 0 or i >= self.length:
return 0
return self._ents[self._e_i-1].start
cdef int L(self, int i, int idx) nogil:
@ -203,7 +203,6 @@ cdef class StateClass:
self._sent[head].l_kids -= 1
cdef void open_ent(self, int label) nogil:
if 0 <= self._e_i < self.length:
self._ents[self._e_i].start = self.B(0)
self._ents[self._e_i].label = label
self._ents[self._e_i].end = -1