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

Sync Span __eq__ and __hash__ #5005

Merged
merged 2 commits into from
Feb 16, 2020

Conversation

adrianeboyd
Copy link
Contributor

Description

Use the same tuple for __eq__ and __hash__, including all attributes except vector and vector_norm.

Fixes #4965.

Types of change

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.

Use the same tuple for `__eq__` and `__hash__`, including all attributes
except `vector` and `vector_norm`.
@svlandeg svlandeg added bug Bugs and behaviour differing from documentation feat / doc Feature: Doc, Span and Token objects labels Feb 12, 2020
Update `assert_docs_equal()` test util to compare `Span` properties for
ents rather than `Span` objects.
@honnibal honnibal merged commit 3b22eb6 into explosion:master Feb 16, 2020
adrianeboyd added a commit to adrianeboyd/spaCy that referenced this pull request Mar 13, 2020
Due to changes to `Span` (explosion#5005), spans from different documents are now
never equal. Check `Token.is_sent_start` values instead.
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.

Span __hash__ and __eq__ are incompatible
3 participants