From 76d89b2180ef5a6bf005270a96b0513c61825c4a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 7 Feb 2018 01:29:23 +0100 Subject: [PATCH] Add test for #1945: PhraseMatcher regression --- spacy/tests/regression/test_issue1945.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spacy/tests/regression/test_issue1945.py diff --git a/spacy/tests/regression/test_issue1945.py b/spacy/tests/regression/test_issue1945.py new file mode 100644 index 000000000..966415d4f --- /dev/null +++ b/spacy/tests/regression/test_issue1945.py @@ -0,0 +1,17 @@ +'''Test regression in PhraseMatcher introduced in v2.0.6.''' +from __future__ import unicode_literals +import pytest + +from ...lang.en import English +from ...matcher import PhraseMatcher + +@pytest.mark.xfail +def test_issue1945(): + text = "deep machine learning" + mw_list = ["machine learning", "deep blue", "planing machine"] + + nlp = English() + matcher = PhraseMatcher(nlp.vocab) + matcher.add("MWE", None, *[nlp.tokenizer(item) for item in mw_list]) + + assert len(matcher(nlp(text))) == 1