From 7539a4f3a81c98b7eeb95cb1a43e26debd4169f4 Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Wed, 21 Aug 2019 21:58:04 +0200 Subject: [PATCH] use states[q] in while retry loop (#4162) --- spacy/matcher/matcher.pyx | 4 ++-- spacy/tests/regression/test_issue3879.py | 1 - spacy/tests/regression/test_issue3951.py | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/spacy/matcher/matcher.pyx b/spacy/matcher/matcher.pyx index a79542929..f22b23260 100644 --- a/spacy/matcher/matcher.pyx +++ b/spacy/matcher/matcher.pyx @@ -307,12 +307,12 @@ cdef void transition_states(vector[PatternStateC]& states, vector[MatchC]& match if action == RETRY_EXTEND: # This handles the 'extend' new_states.push_back( - PatternStateC(pattern=state.pattern, start=state.start, + PatternStateC(pattern=states[q].pattern, start=state.start, length=state.length+1)) if action == RETRY_ADVANCE: # This handles the 'advance' new_states.push_back( - PatternStateC(pattern=state.pattern+1, start=state.start, + PatternStateC(pattern=states[q].pattern+1, start=state.start, length=state.length+1)) states[q].pattern += 1 if states[q].pattern.nr_py != 0: diff --git a/spacy/tests/regression/test_issue3879.py b/spacy/tests/regression/test_issue3879.py index 9812f8380..908c6c435 100644 --- a/spacy/tests/regression/test_issue3879.py +++ b/spacy/tests/regression/test_issue3879.py @@ -6,7 +6,6 @@ from spacy.matcher import Matcher from spacy.tokens import Doc -@pytest.mark.xfail def test_issue3879(en_vocab): doc = Doc(en_vocab, words=["This", "is", "a", "test", "."]) assert len(doc) == 5 diff --git a/spacy/tests/regression/test_issue3951.py b/spacy/tests/regression/test_issue3951.py index f9912c494..7e1e213c0 100644 --- a/spacy/tests/regression/test_issue3951.py +++ b/spacy/tests/regression/test_issue3951.py @@ -6,7 +6,6 @@ from spacy.matcher import Matcher from spacy.tokens import Doc -@pytest.mark.xfail def test_issue3951(en_vocab): """Test that combinations of optional rules are matched correctly.""" matcher = Matcher(en_vocab)