mirror of
https://github.com/explosion/spaCy.git
synced 2025-06-02 20:23:12 +03:00
Add TODO in notes
This commit is contained in:
parent
b00326a7fe
commit
9115c3ba0a
|
@ -37,10 +37,11 @@ def transition(state, token, matches, nexts):
|
||||||
start = token.i
|
start = token.i
|
||||||
if is_match:
|
if is_match:
|
||||||
matches.append((pattern, start, token.i+1))
|
matches.append((pattern, start, token.i+1))
|
||||||
if keep_state:
|
|
||||||
nexts.append((pattern, i, start))
|
|
||||||
if advance_state:
|
if advance_state:
|
||||||
nexts.append((pattern, i+1, start))
|
nexts.append((pattern, i+1, start))
|
||||||
|
if keep_state:
|
||||||
|
# TODO: This needs to be zero-width :(.
|
||||||
|
nexts.append((pattern, i, start))
|
||||||
return (matches, nexts)
|
return (matches, nexts)
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ def get_action(state, token):
|
||||||
elif is_match:
|
elif is_match:
|
||||||
return '011'
|
return '011'
|
||||||
else:
|
else:
|
||||||
return '010'
|
return '001'
|
||||||
else:
|
else:
|
||||||
print(operator, is_match, is_final)
|
print(operator, is_match, is_final)
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
@ -245,7 +246,7 @@ def test_find_matches_greedy():
|
||||||
assert matches == [(patterns[0], 0, 1), (patterns[0], 0, 2), (patterns[0], 1, 2)]
|
assert matches == [(patterns[0], 0, 1), (patterns[0], 0, 2), (patterns[0], 1, 2)]
|
||||||
|
|
||||||
def test_find_matches_non_greedy():
|
def test_find_matches_non_greedy():
|
||||||
patterns = [[{'spec': 'a', 'op': '0+'}, {'spec': 'b'}]]
|
patterns = [[{'spec': 'a', 'op': '0+'}, {'spec': 'b', "op": "1"}]]
|
||||||
doc = Doc(Vocab(), words=['b'])
|
doc = Doc(Vocab(), words=['b'])
|
||||||
matches = find_matches(patterns, doc)
|
matches = find_matches(patterns, doc)
|
||||||
assert matches == [(patterns[0], 0, 1)]
|
assert matches == [(patterns[0], 0, 1)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user