mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
Fix matcher test
This commit is contained in:
parent
eaf4065480
commit
b00f683a0c
|
@ -88,11 +88,17 @@ def test_match_zero_plus(matcher):
|
|||
|
||||
|
||||
@pytest.mark.models
|
||||
def test_match_preserved(matcher, EN):
|
||||
doc = EN.tokenizer('I like java')
|
||||
def test_match_preserved(EN):
|
||||
patterns = {
|
||||
'JS': ['PRODUCT', {}, [[{'ORTH': 'JavaScript'}]]],
|
||||
'GoogleNow': ['PRODUCT', {}, [[{'ORTH': 'Google'}, {'ORTH': 'Now'}]]],
|
||||
'Java': ['PRODUCT', {}, [[{'LOWER': 'java'}]]],
|
||||
}
|
||||
matcher = Matcher(EN.vocab, patterns)
|
||||
doc = EN.tokenizer('I like java.')
|
||||
EN.tagger(doc)
|
||||
assert len(doc.ents) == 0
|
||||
doc = EN.tokenizer('I like java')
|
||||
doc = EN.tokenizer('I like java.')
|
||||
doc.ents += tuple(matcher(doc))
|
||||
assert len(doc.ents) == 1
|
||||
EN.tagger(doc)
|
||||
|
|
Loading…
Reference in New Issue
Block a user