From 75805397dd62cfa00eb9a9d253259ea9c79f426b Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 6 Nov 2016 10:42:32 +0100 Subject: [PATCH] Test Issue #605 --- spacy/tests/regression/test_issue605.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 spacy/tests/regression/test_issue605.py diff --git a/spacy/tests/regression/test_issue605.py b/spacy/tests/regression/test_issue605.py new file mode 100644 index 000000000..9e299690d --- /dev/null +++ b/spacy/tests/regression/test_issue605.py @@ -0,0 +1,24 @@ +from ...attrs import LOWER, ORTH +from ...tokens import Doc +from ...vocab import Vocab +from ...matcher import Matcher + + +def return_false(doc, ent_id, label, start, end): + return False + + +def test_matcher_accept(): + doc = Doc(Vocab(), words=[u'The', u'golf', u'club', u'is', u'broken']) + + golf_pattern = [ + { ORTH: "golf"}, + { ORTH: "club"} + ] + matcher = Matcher(doc.vocab) + + matcher.add_entity('Sport_Equipment', acceptor=return_false) + matcher.add_pattern("Sport_Equipment", golf_pattern) + match = matcher(doc) + + assert match == []