From 6abcbdeee6259d4c8cd1b9c702c7e73e5ed67753 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Mon, 28 Nov 2022 12:43:07 +0100 Subject: [PATCH] Reorder conditions to improve speed --- spacy/matcher/matcher.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/matcher/matcher.pyx b/spacy/matcher/matcher.pyx index 3a80561cb..7676aa510 100644 --- a/spacy/matcher/matcher.pyx +++ b/spacy/matcher/matcher.pyx @@ -672,7 +672,7 @@ cdef action_t get_action(PatternStateC state, if is_match and is_final: # Yes, final: 1000 return MATCH - elif is_non_greedy_plus(state) and has_star_tail(state) and is_match and not is_final: + elif is_match and not is_final and is_non_greedy_plus(state) and has_star_tail(state): # Yes, non-final: 1100 # Modification for +?: # Having MATCH_ADVANCE handles the match at the 'ONE' part of the token instead of relying on MATCH_REJECT