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

Matcher does not support attribute IS_SENT_START #5073

Closed
alessandrobokan opened this issue Feb 28, 2020 · 2 comments · Fixed by #5080
Closed

Matcher does not support attribute IS_SENT_START #5073

alessandrobokan opened this issue Feb 28, 2020 · 2 comments · Fixed by #5080
Labels
bug Bugs and behaviour differing from documentation feat / matcher Feature: Token, phrase and dependency matcher

Comments

@alessandrobokan
Copy link

How to reproduce the behaviour

When I tried to add a pattern to the spacy Matcher with the attribute IS_SENT_START gives me an error

from spacy.matcher import Matcher
matcher = Matcher(nlp.vocab)
matcher.add("rule1", None, [{"IS_SENT_START": True, "LOWER": "hello"}])

ValueError: [E152] The attribute None is not supported for token patterns. Please use the option validate=True with Matcher, PhraseMatcher, or EntityRuler for more details.

I analysed the source-code of matcher.pyx and I see that attr IS_SENT_START is in TOKEN_PATTERN_SCHEMA but in the file attrs.pdx appears as SENT_START, causing the error.

This issue could be solved by adding following condition after this line 674

if attr == "IS_SENT_START":
    attr = "SENT_START"

Your Environment

  • Operating System: Ubuntu 18.04
  • Python Version Used: 3.6
  • spaCy Version Used: 2.2.3
  • Environment Information: virtualenv
@adrianeboyd adrianeboyd added bug Bugs and behaviour differing from documentation feat / matcher Feature: Token, phrase and dependency matcher labels Mar 2, 2020
@adrianeboyd
Copy link
Contributor

Thanks for the report! This should be fixed by #5080.

@lock
Copy link

lock bot commented Apr 2, 2020

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 Apr 2, 2020
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 feat / matcher Feature: Token, phrase and dependency matcher
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants