From c99285b8b9f6f5aec2ff4b58df9854497f7351aa Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 18 Oct 2015 17:20:50 +1100 Subject: [PATCH] * Clean up C++ usage in spacy/matcher.pyx --- spacy/matcher.pyx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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)