-
-
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
Fix for ZeroDivisionError: float division by zero in pagerank_weighted.py #851 #887
Conversation
Returns the input, if only one sentence is present in document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fix would be: If less than word_count*ratio
words are given then just return them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fix would be: If less than word_count*ratio
words are given then just return them.
Please also add a test and a line in CHANGELOG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix. Please add changelog.
Added test for single sentence input
Added test for single sentence input #851
Please run tests locally before committing to the main repo |
For some reason, this build terminated for Python 2.6, ran successfully for all other version. |
So, I removed the logging statement and it passed. I don't understand how. |
# Keeps the first sentence only. | ||
text = text.split('\n')[0] | ||
|
||
self.assertTrue(summarize(text) is not None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please assert that the return is equal to text.
@metalaman Thanks a lot for the PR! |
Returns the original text as soon as it finds only one sentence present in the document.