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

Improve token head verification #5079

Merged

Conversation

adrianeboyd
Copy link
Contributor

Description

Improve the verification for valid token heads when heads are set:

  • in Token.head: heads come from the same document
  • in Doc.from_array(): head indices are within the bounds of the document

Addresses segfault in #5075 by making it impossible to create invalid heads in a document with Doc.from_array().

Types of change

Bug fix.

Checklist

  • I have submitted the spaCy Contributor Agreement.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

Improve the verification for valid token heads when heads are set:

* in `Token.head`: heads come from the same document
* in `Doc.from_array()`: head indices are within the bounds of the
document
@adrianeboyd
Copy link
Contributor Author

I'm not sure which head value to show in E190. I'm currently using the actual value from the array, but it makes the error message kind of hard to understand.

@adrianeboyd adrianeboyd added bug Bugs and behaviour differing from documentation feat / doc Feature: Doc, Span and Token objects labels Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and behaviour differing from documentation feat / doc Feature: Doc, Span and Token objects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants