-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Creating an instance of Doc with a wrongly-typed word list results in wrong TypeError #9437
Comments
This error is confusing but what's happening is that when it's not a string it's being treated as potentially an ID/hash. That would be an int type as an argument to We can look at making the error clearer. I'm not sure we actually need to support providing IDs in this context anyway, so that's something else we can check. |
* Clarify error when words are of wrong type See #9437 * Update docs * Use try/except * Apply suggestions from code review Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com> Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com> Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com> Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
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. |
How to reproduce the behaviour
We forget to cast an object to string, using str(potato()) as an example.
results in the error
whereas it should result in
The line 268 in spacy.tokens.doc.Doc.init does however not raise this specific error message, unless I am mistaken. I propose adding another elif clause to check if it is not a string, and raising an error. I don't know what the else clause is for, so I am not opening a pull request (although I could, if desired)
Your Environment
The text was updated successfully, but these errors were encountered: