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