From d48218f4b2ea17747061316603df06507773ab9c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 29 Apr 2015 22:14:43 +0200 Subject: [PATCH] * Add left_edge and right_edge properties --- spacy/tokens.pyx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spacy/tokens.pyx b/spacy/tokens.pyx index 3d90abb8b..7800b0e0d 100644 --- a/spacy/tokens.pyx +++ b/spacy/tokens.pyx @@ -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."""