* Add left_edge and right_edge properties

This commit is contained in:
Matthew Honnibal 2015-04-29 22:14:43 +02:00
parent bdb56497b5
commit d48218f4b2
1 changed files with 12 additions and 0 deletions

View File

@ -533,6 +533,18 @@ cdef class Token:
for word in self.rights:
yield from word.subtree
property left_edge:
def __get__(self):
return Token.cinit(self.vocab, self._string,
self.c + self.c.l_edge, self.i + self.c.l_edge,
self.array_len, self._seq)
property right_edge:
def __get__(self):
return Token.cinit(self.vocab, self._string,
self.c + self.c.r_edge, self.i + self.c.r_edge,
self.array_len, self._seq)
property head:
def __get__(self):
"""The token predicted by the parser to be the head of the current token."""