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

Fix for ZeroDivisionError: float division by zero in pagerank_weighted.py #851 #887

Merged
merged 10 commits into from
Sep 29, 2016
Merged

Conversation

metalaman
Copy link
Contributor

Returns the original text as soon as it finds only one sentence present in the document.

Returns the input, if only one sentence is present in document.
Copy link
Contributor

@tmylk tmylk left a 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.

Copy link
Contributor

@tmylk tmylk left a 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.

@tmylk
Copy link
Contributor

tmylk commented Sep 28, 2016

Please also add a test and a line in CHANGELOG

Copy link
Contributor

@tmylk tmylk left a 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.

@tmylk
Copy link
Contributor

tmylk commented Sep 29, 2016

Please run tests locally before committing to the main repo

@metalaman
Copy link
Contributor Author

metalaman commented Sep 29, 2016

For some reason, this build terminated for Python 2.6, ran successfully for all other version.
On my local branch, it didn't give any error like this.
Can you please rebuild it again?

@metalaman
Copy link
Contributor Author

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)
Copy link
Contributor

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.

@tmylk
Copy link
Contributor

tmylk commented Sep 29, 2016

@metalaman Thanks a lot for the PR!

harshuljain13 pushed a commit to harshuljain13/gensim that referenced this pull request Sep 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants