From 0bb839d29903105155e645a156dd89c006f76700 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 24 Jul 2015 03:49:30 +0200 Subject: [PATCH] * Fix string coercion for Python 3 --- spacy/tokens/doc.pyx | 5 ++++- spacy/tokens/token.pyx | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index 72b83720e..771d93804 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -111,9 +111,12 @@ cdef class Doc: def __unicode__(self): return u''.join([t.string for t in self]) + def __str__(self): + return u''.join([t.string for t in self]) + @property def string(self): - return unicode(self) + return u''.join([t.string for t in self]) @property def ents(self): diff --git a/spacy/tokens/token.pyx b/spacy/tokens/token.pyx index 194205cc1..bbc12d549 100644 --- a/spacy/tokens/token.pyx +++ b/spacy/tokens/token.pyx @@ -34,6 +34,9 @@ cdef class Token: def __unicode__(self): return self.string + def __str__(self): + return self.string + cpdef bint check_flag(self, attr_id_t flag_id) except -1: return check_flag(self.c.lex, flag_id)