-
-
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
Warning and similarity based on empty vector #3745
Comments
If someone knows how to suppress warnings, maybe it will prevent the error ? |
This is very strange – I'm confused that the error occurs in PyPDF2, since this package shouldn't have to do anything with it at all? 🤔 Are you doing anything custom with it?
You should be able to set the |
I used PyPDF2 in the project but just to read documents. It's strange to me too. Warning lib use PyPDF2 ?
Maybe it's not a spacy issue ?
In python or in Ubuntu ? |
An other way to search, I used Camelot earlier in the script which is using PyPDF2 to extract some datas. I don't know if it changes some PyPDF2 parameters. |
Yeah, it's weird that there's an interaction between the two. I think I may have found the cause – check out these lines in # have to dynamically override the default showwarning since there are no
# public methods that specify the 'file' parameter
def _showwarning(message, category, filename, lineno, file=warndest, line=None):
if file is None:
file = sys.stderr
try:
file.write(formatWarning(message, category, filename, lineno, line))
except IOError:
pass
warnings.showwarning = _showwarning So basically, in the I'm not really sure what we should do about this, since we can't so easily work around other third-party packages monkeypatching Python built-ins. I would argue that monkeypatching Python builtins isn't really a good practice, for this exact reason. Edit: Just found this thread discussing the problem and there seems to be an open PR about this. So it should probably be fixed in PyPDF2 soon 🎉 py-pdf/pypdf#67
On the command line in your terminal etc., so when you execute the Python file. For example: SPACY_WARNING_IGNORE=W008 python nlp.py You can also export SPACY_WARNING_IGNORE=W008 If you're using an IDE like PyCharm etc. to execute your code, there's usually an option to set environment variables from within the editor as well. |
Thank you @ines, you rocked ! |
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. |
Hello, I have an issue using Spacy and french model.
How to reproduce the behaviour
self.nlp = spacy.load('fr_core_news_md')
self.nlp(string1).similarity(self.nlp(string2))
First, i had this error :
So I tried to just take my string out of my algo (it was in a dataframe, nvm) and it gives :
I don't know why the warning is not working the first time.
My Environment
The text was updated successfully, but these errors were encountered: