mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Fix Issue #50: Python 3 compatibility of v0.80
This commit is contained in:
parent
ee317446bd
commit
2b84a90bbb
|
@ -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)
|
||||
|
|
|
@ -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."""
|
||||
|
|
Loading…
Reference in New Issue
Block a user