diff --git a/spacy/matcher/matcher.pyx b/spacy/matcher/matcher.pyx index 696c10ee2..5dd827ab3 100644 --- a/spacy/matcher/matcher.pyx +++ b/spacy/matcher/matcher.pyx @@ -755,6 +755,7 @@ cdef int8_t get_is_match(PatternStateC state, return 0 return True + cdef action_t cast_to_non_greedy_action(action_t action, action_t next_action, vector[PatternStateC]& new_states, vector[vector[MatchAlignmentC]]& align_new_states, bint with_alignments) nogil: """Cast "next_action" to another "action" that demonstrates non-greedy behaviour. @@ -811,6 +812,7 @@ cdef action_t cast_to_non_greedy_action(action_t action, action_t next_action, v else: return next_action + cdef inline int8_t get_is_final(PatternStateC state) nogil: if state.pattern[1].quantifier == FINAL_ID: return 1 @@ -830,6 +832,7 @@ cdef inline int8_t is_non_greedy_plus(PatternStateC state, int8_t quantifier) no else: return 0 + cdef inline int8_t is_non_greedy_star(PatternStateC state, int8_t quantifier) nogil: """Verify whether current state pattern is '*?'""" if (state.pattern - 1).quantifier != ONE and quantifier == ZERO_MINUS: @@ -837,6 +840,7 @@ cdef inline int8_t is_non_greedy_star(PatternStateC state, int8_t quantifier) no else: return 0 + cdef inline int8_t has_star_tail(PatternStateC state) nogil: """Verify whether all remaining patterns are either '*' or '*?'""" while not get_is_final(state): @@ -845,6 +849,7 @@ cdef inline int8_t has_star_tail(PatternStateC state) nogil: return 0 return 1 + cdef inline int8_t has_non_greedy_tail(PatternStateC state) nogil: """Verify whether all remaining patterns are '*?'""" while not get_is_final(state): @@ -853,6 +858,7 @@ cdef inline int8_t has_non_greedy_tail(PatternStateC state) nogil: return 0 return 1 + cdef TokenPatternC* init_pattern(Pool mem, attr_t entity_id, object token_specs) except NULL: pattern = mem.alloc(len(token_specs) + 1, sizeof(TokenPatternC)) cdef int i, index