mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26: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):
|
def __call__(self, tokens):
|
||||||
for tag, entity_type, regex in self.regexes:
|
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)
|
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]
|
cdef const TokenC* last = &self.data[self.length - 1]
|
||||||
return self._string[:last.idx + last.lex.length]
|
return self._string[:last.idx + last.lex.length]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def string(self):
|
||||||
|
return unicode(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ents(self):
|
def ents(self):
|
||||||
"""Yields named-entity Span objects."""
|
"""Yields named-entity Span objects."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user