From b00f683a0c5947447cbc23451293102b2f9bf7af Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 24 Sep 2016 11:20:58 +0200 Subject: [PATCH] Fix matcher test --- spacy/tests/test_matcher.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spacy/tests/test_matcher.py b/spacy/tests/test_matcher.py index 1cb3c1e35..aade59918 100644 --- a/spacy/tests/test_matcher.py +++ b/spacy/tests/test_matcher.py @@ -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)