mirror of https://github.com/explosion/spaCy.git
* Add stack and queue properties to stateclass, for python access
This commit is contained in:
parent
3af938365f
commit
7bafc789e7
|
@ -36,6 +36,14 @@ cdef class StateClass:
|
|||
self._buffer[i] = i
|
||||
self._empty_token.lex = &EMPTY_LEXEME
|
||||
|
||||
@property
|
||||
def stack(self):
|
||||
return {self.S(i) for i in range(self._s_i)}
|
||||
|
||||
@property
|
||||
def queue(self):
|
||||
return {self.B(i) for i in range(self._b_i, self.length)}
|
||||
|
||||
cdef int E(self, int i) nogil:
|
||||
if self._e_i <= 0 or self._e_i >= self.length:
|
||||
return 0
|
||||
|
|
Loading…
Reference in New Issue