mirror of https://github.com/explosion/spaCy.git
* Clean up C++ usage in spacy/matcher.pyx
This commit is contained in:
parent
fc261195f7
commit
c99285b8b9
|
@ -20,8 +20,6 @@ from .tokens.doc cimport get_token_attr
|
||||||
from .tokens.doc cimport Doc
|
from .tokens.doc cimport Doc
|
||||||
from .vocab cimport Vocab
|
from .vocab cimport Vocab
|
||||||
|
|
||||||
from libcpp.vector cimport vector
|
|
||||||
|
|
||||||
from .attrs import FLAG61 as U_ENT
|
from .attrs import FLAG61 as U_ENT
|
||||||
|
|
||||||
from .attrs import FLAG60 as B2_ENT
|
from .attrs import FLAG60 as B2_ENT
|
||||||
|
@ -221,8 +219,7 @@ cdef class Matcher:
|
||||||
q = 0
|
q = 0
|
||||||
# Go over the open matches, extending or finalizing if able. Otherwise,
|
# Go over the open matches, extending or finalizing if able. Otherwise,
|
||||||
# we over-write them (q doesn't advance)
|
# we over-write them (q doesn't advance)
|
||||||
for i in range(partials.size()):
|
for state in partials:
|
||||||
state = partials.at(i)
|
|
||||||
if match(state, token):
|
if match(state, token):
|
||||||
if is_final(state):
|
if is_final(state):
|
||||||
label, start, end = get_entity(state, token, token_i)
|
label, start, end = get_entity(state, token, token_i)
|
||||||
|
@ -233,8 +230,7 @@ cdef class Matcher:
|
||||||
q += 1
|
q += 1
|
||||||
partials.resize(q)
|
partials.resize(q)
|
||||||
# Check whether we open any new patterns on this token
|
# Check whether we open any new patterns on this token
|
||||||
for i in range(self.n_patterns):
|
for state in self.patterns:
|
||||||
state = self.patterns[i]
|
|
||||||
if match(state, token):
|
if match(state, token):
|
||||||
if is_final(state):
|
if is_final(state):
|
||||||
label, start, end = get_entity(state, token, token_i)
|
label, start, end = get_entity(state, token, token_i)
|
||||||
|
|
Loading…
Reference in New Issue