explosion/spaCy

Segmentation fault while using matcher

sadovnychyi opened this issue · 5 comments

As mentioned in #429. I have manually installed spacy with this fix which you did yesterday. It took me a lot of time to catch this.. so here we are:

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=[[{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))

->

Segmentation fault: 11

Thrown from the last line.

Hm, was silently ignoring an error condition.

Fixed now, but looking at this, I doubt this will be the last error. Hopefully they should report more cleanly now though.

Thanks!

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

How do I go from here? Seems like there's no debug logs available.

Ok, got it. Hope you don't mind if I'll leave it here.

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.

I had that last week but it disappeared when I updated the data. I was suspecting empty pattern/key caused it. Thanks for the explanation!

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.