mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
use states[q] in while retry loop (#4162)
This commit is contained in:
parent
b072c13017
commit
7539a4f3a8
|
@ -307,12 +307,12 @@ cdef void transition_states(vector[PatternStateC]& states, vector[MatchC]& match
|
||||||
if action == RETRY_EXTEND:
|
if action == RETRY_EXTEND:
|
||||||
# This handles the 'extend'
|
# This handles the 'extend'
|
||||||
new_states.push_back(
|
new_states.push_back(
|
||||||
PatternStateC(pattern=state.pattern, start=state.start,
|
PatternStateC(pattern=states[q].pattern, start=state.start,
|
||||||
length=state.length+1))
|
length=state.length+1))
|
||||||
if action == RETRY_ADVANCE:
|
if action == RETRY_ADVANCE:
|
||||||
# This handles the 'advance'
|
# This handles the 'advance'
|
||||||
new_states.push_back(
|
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))
|
length=state.length+1))
|
||||||
states[q].pattern += 1
|
states[q].pattern += 1
|
||||||
if states[q].pattern.nr_py != 0:
|
if states[q].pattern.nr_py != 0:
|
||||||
|
|
|
@ -6,7 +6,6 @@ from spacy.matcher import Matcher
|
||||||
from spacy.tokens import Doc
|
from spacy.tokens import Doc
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail
|
|
||||||
def test_issue3879(en_vocab):
|
def test_issue3879(en_vocab):
|
||||||
doc = Doc(en_vocab, words=["This", "is", "a", "test", "."])
|
doc = Doc(en_vocab, words=["This", "is", "a", "test", "."])
|
||||||
assert len(doc) == 5
|
assert len(doc) == 5
|
||||||
|
|
|
@ -6,7 +6,6 @@ from spacy.matcher import Matcher
|
||||||
from spacy.tokens import Doc
|
from spacy.tokens import Doc
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail
|
|
||||||
def test_issue3951(en_vocab):
|
def test_issue3951(en_vocab):
|
||||||
"""Test that combinations of optional rules are matched correctly."""
|
"""Test that combinations of optional rules are matched correctly."""
|
||||||
matcher = Matcher(en_vocab)
|
matcher = Matcher(en_vocab)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user