Skip to content

Commit

Permalink
Test Issue #605
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Nov 6, 2016
1 parent 5e4e5b6 commit 7580539
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spacy/tests/regression/test_issue605.py
Original file line number Diff line number Diff line change
@@ -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 == []

0 comments on commit 7580539

Please sign in to comment.