From 782e4814f4ef4c5dead5cd633dd07b35400636b0 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 28 Oct 2016 16:38:32 +0200 Subject: [PATCH] Test Issue #587: Matcher segfaults on particular input --- spacy/tests/regression/test_issue587.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 spacy/tests/regression/test_issue587.py diff --git a/spacy/tests/regression/test_issue587.py b/spacy/tests/regression/test_issue587.py new file mode 100644 index 000000000..9f2a317f5 --- /dev/null +++ b/spacy/tests/regression/test_issue587.py @@ -0,0 +1,16 @@ +import spacy +import spacy.matcher + +import pytest + +@pytest.mark.models +def test_matcher_segfault(): + nlp = spacy.load('en', parser=False, entity=False) + matcher = spacy.matcher.Matcher(nlp.vocab) + content = u'''a b; c''' + matcher.add(entity_key='1', label='TEST', attrs={}, specs=[[{65: 'a'}, {65: 'b'}]]) + matcher(nlp(content)) + matcher.add(entity_key='2', label='TEST', attrs={}, specs=[[{65: 'a'}, {65: 'b'}, {5: True}, {65: 'c'}]]) + matcher(nlp(content)) + matcher.add(entity_key='3', label='TEST', attrs={}, specs=[[{65: 'a'}, {65: 'b'}, {5: True}, {65: 'd'}]]) + matcher(nlp(content))