* Fix Issue #50: Python 3 compatibility of v0.80

This commit is contained in:
Matthew Honnibal 2015-04-13 05:59:43 +02:00
parent ee317446bd
commit 2b84a90bbb
2 changed files with 5 additions and 1 deletions

View File

@ -4,5 +4,5 @@ class RegexMerger(object):
def __call__(self, tokens):
for tag, entity_type, regex in self.regexes:
for m in regex.finditer(unicode(tokens)):
for m in regex.finditer(tokens.string):
tokens.merge(m.start(), m.end(), tag, m.group(), entity_type)

View File

@ -136,6 +136,10 @@ cdef class Tokens:
cdef const TokenC* last = &self.data[self.length - 1]
return self._string[:last.idx + last.lex.length]
@property
def string(self):
return unicode(self)
@property
def ents(self):
"""Yields named-entity Span objects."""