Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault while using matcher #587

Closed
sadovnychyi opened this issue Oct 28, 2016 · 5 comments
Closed

Segmentation fault while using matcher #587

sadovnychyi opened this issue Oct 28, 2016 · 5 comments
Labels
bug Bugs and behaviour differing from documentation

Comments

@sadovnychyi
Copy link
Contributor

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.

@honnibal honnibal added the bug Bugs and behaviour differing from documentation label Oct 28, 2016
@honnibal
Copy link
Member

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.

@sadovnychyi
Copy link
Contributor Author

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.

@sadovnychyi
Copy link
Contributor Author

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.

@savkov
Copy link
Contributor

savkov commented Nov 10, 2016

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
Copy link

lock bot commented May 9, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation
Projects
None yet
Development

No branches or pull requests

3 participants