explosion/spaCy

Empty specs accepted by matcher.add_pattern, but cause error

honnibal opened this issue · 1 comments

From Issue #429:

import spacy
import spacy.matcher

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=[[]])
matcher(nlp(content))
->

Traceback (most recent call last): 
  File "word2vec/matcher_bla.py", line 8, in <module>
    matcher(nlp(content))
  File "spacy/matcher.pyx", line 315, in spacy.matcher.Matcher.__call__ (spacy/matcher.cpp:8519)
Exception: Error selecting action in matcher

Caused by empty specs. While I understand that this is a mistake in my data it's better to check this when entity is being added.

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.