2017-01-10 18:24:10 +00:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2017-01-12 21:00:37 +00:00
|
|
|
from ...attrs import ORTH
|
2016-11-06 09:42:32 +00:00
|
|
|
from ...matcher import Matcher
|
2017-01-12 21:00:37 +00:00
|
|
|
from ..util import get_doc
|
2016-11-06 09:42:32 +00:00
|
|
|
|
|
|
|
|
2017-01-12 21:00:37 +00:00
|
|
|
def test_issue605(en_vocab):
|
|
|
|
def return_false(doc, ent_id, label, start, end):
|
|
|
|
return False
|
2016-11-06 09:42:32 +00:00
|
|
|
|
2017-01-12 21:00:37 +00:00
|
|
|
words = ["The", "golf", "club", "is", "broken"]
|
|
|
|
pattern = [{ORTH: "golf"}, {ORTH: "club"}]
|
|
|
|
label = "Sport_Equipment"
|
|
|
|
doc = get_doc(en_vocab, words)
|
2016-11-06 09:42:32 +00:00
|
|
|
matcher = Matcher(doc.vocab)
|
2017-01-12 21:00:37 +00:00
|
|
|
matcher.add_entity(label, acceptor=return_false)
|
|
|
|
matcher.add_pattern(label, pattern)
|
2016-11-06 09:42:32 +00:00
|
|
|
match = matcher(doc)
|
|
|
|
assert match == []
|