From 86c056ba649f876982c1a35218326360cccbfba8 Mon Sep 17 00:00:00 2001 From: Dmitry Sadovnychyi Date: Wed, 9 Nov 2016 00:10:32 +0800 Subject: [PATCH] Add basic test for PhraseMatcher #613 --- spacy/tests/test_matcher.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spacy/tests/test_matcher.py b/spacy/tests/test_matcher.py index 9f04a7a0d..903328981 100644 --- a/spacy/tests/test_matcher.py +++ b/spacy/tests/test_matcher.py @@ -87,6 +87,13 @@ def test_match_zero_plus(matcher): assert len(matcher(doc)) == 1 +def test_phrase_matcher(): + vocab = Vocab(lex_attr_getters=English.Defaults.lex_attr_getters) + matcher = PhraseMatcher(vocab, [Doc(vocab, words='Google Now'.split())]) + doc = Doc(vocab, words=['I', 'like', 'Google', 'Now', 'best']) + assert len(matcher(doc)) == 1 + + #@pytest.mark.models #def test_match_preserved(EN): # patterns = {