* Fix string coercion for Python 3

This commit is contained in:
Matthew Honnibal 2015-07-24 03:49:30 +02:00
parent c4ff410fdb
commit 0bb839d299
2 changed files with 7 additions and 1 deletions

View File

@ -111,9 +111,12 @@ cdef class Doc:
def __unicode__(self): def __unicode__(self):
return u''.join([t.string for t in self]) return u''.join([t.string for t in self])
def __str__(self):
return u''.join([t.string for t in self])
@property @property
def string(self): def string(self):
return unicode(self) return u''.join([t.string for t in self])
@property @property
def ents(self): def ents(self):

View File

@ -34,6 +34,9 @@ cdef class Token:
def __unicode__(self): def __unicode__(self):
return self.string return self.string
def __str__(self):
return self.string
cpdef bint check_flag(self, attr_id_t flag_id) except -1: cpdef bint check_flag(self, attr_id_t flag_id) except -1:
return check_flag(self.c.lex, flag_id) return check_flag(self.c.lex, flag_id)