From cff2b13fef2e05a3c7be25670cc2337a2575e3c2 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 7 Apr 2015 06:08:25 +0200 Subject: [PATCH] * Fix Issue #44: Broken Token.string attribute when single word sentence --- spacy/tokens.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/tokens.pyx b/spacy/tokens.pyx index 8747cab8a..5c0841f54 100644 --- a/spacy/tokens.pyx +++ b/spacy/tokens.pyx @@ -379,6 +379,8 @@ cdef class Token: property string: def __get__(self): + if (self.i+1) == self._seq.length: + return self._string[self.c.idx:] cdef int next_idx = (self.c + 1).idx if next_idx < self.c.idx: next_idx = self.c.idx + self.c.lex.length