diff --git a/spacy/matcher.pyx b/spacy/matcher.pyx index 2bf8370b5..0a1bb3c69 100644 --- a/spacy/matcher.pyx +++ b/spacy/matcher.pyx @@ -20,8 +20,6 @@ from .tokens.doc cimport get_token_attr from .tokens.doc cimport Doc from .vocab cimport Vocab -from libcpp.vector cimport vector - from .attrs import FLAG61 as U_ENT from .attrs import FLAG60 as B2_ENT @@ -221,8 +219,7 @@ cdef class Matcher: q = 0 # Go over the open matches, extending or finalizing if able. Otherwise, # we over-write them (q doesn't advance) - for i in range(partials.size()): - state = partials.at(i) + for state in partials: if match(state, token): if is_final(state): label, start, end = get_entity(state, token, token_i) @@ -233,8 +230,7 @@ cdef class Matcher: q += 1 partials.resize(q) # Check whether we open any new patterns on this token - for i in range(self.n_patterns): - state = self.patterns[i] + for state in self.patterns: if match(state, token): if is_final(state): label, start, end = get_entity(state, token, token_i)