use states[q] in while retry loop (#4162)

This commit is contained in:
Sofie Van Landeghem 2019-08-21 21:58:04 +02:00 committed by Matthew Honnibal
parent b072c13017
commit 7539a4f3a8
3 changed files with 2 additions and 4 deletions

View File

@ -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:

View File

@ -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

View File

@ -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)