From 7f551050b13177023c4b453fa00dbf2ada6db255 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Tue, 16 Jul 2019 13:07:35 +0200 Subject: [PATCH] Add regression test for #3972 --- spacy/tests/regression/test_issue3972.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 spacy/tests/regression/test_issue3972.py diff --git a/spacy/tests/regression/test_issue3972.py b/spacy/tests/regression/test_issue3972.py new file mode 100644 index 000000000..e82dff269 --- /dev/null +++ b/spacy/tests/regression/test_issue3972.py @@ -0,0 +1,18 @@ +# coding: utf8 +from __future__ import unicode_literals + +import pytest +from spacy.matcher import PhraseMatcher +from spacy.tokens import Doc + + +@pytest.mark.xfail +def test_issue3972(en_vocab): + """Test that the PhraseMatcher returns duplicates for duplicate match IDs. + """ + matcher = PhraseMatcher(en_vocab) + matcher.add("A", None, Doc(en_vocab, words=["New", "York"])) + matcher.add("B", None, Doc(en_vocab, words=["New", "York"])) + doc = Doc(en_vocab, words=["I", "live", "in", "New", "York"]) + matches = matcher(doc) + assert len(matches) == 2