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 Issue #805: Added check in summarize_corpus #885

Merged
merged 6 commits into from
Sep 29, 2016

Conversation

anmolgulati
Copy link
Contributor

@anmolgulati anmolgulati commented Sep 25, 2016

@anmolgulati anmolgulati changed the title Fix Isse #805: Added check in summarize_corpus Fix Issue #805: Added check in summarize_corpus Sep 25, 2016
@tmylk
Copy link
Contributor

tmylk commented Sep 26, 2016

Thanks for taking this up. Please add a test for the warning.

@@ -158,6 +158,11 @@ def summarize_corpus(corpus, ratio=0.2):
_set_graph_edge_weights(graph)
_remove_unreachable_nodes(graph)

# If the number of nodes < 3, the function ends.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a better comment explaining original error

@tmylk
Copy link
Contributor

tmylk commented Sep 28, 2016

Looks good. Please add a note in the CHANGELOG for 0.13.3 release and will merge once the tests pass.

@anmolgulati
Copy link
Contributor Author

I've made the changes now.
The test_get_texts_returns_generator_of_lists (gensim.test.test_wikicorpus.TestWikiCorpus) test hangs in python 2.6 on Travis. I'm not really able to find out about this.
@tmylk Any suggestions?

@tmylk
Copy link
Contributor

tmylk commented Sep 29, 2016

Hi @anmol01gulati , it is some travis weirdness with gensim.test.test_wikicorpus.TestWikiCorpus. Just add/remove blank line to the file and it should run fine as in #887

Added blank line to fix issue with travis CI
@tmylk tmylk merged commit f7dd826 into piskvorky:develop Sep 29, 2016
@tmylk
Copy link
Contributor

tmylk commented Sep 29, 2016

Great. Thanks for the pr!

harshuljain13 pushed a commit to harshuljain13/gensim that referenced this pull request Sep 30, 2016
…words (piskvorky#885)

* Added check in summarize_corpus to fix bug in summarizer

* Fix piskvorky#805: Added check in summarizing text

* Added test for checking low number of distinct words in text

* Text split method changed to allow running in Python 3.3 and above.

* Change to fix test in python versions 3.3 and higher

* Added blank line test_wikicorpus.py file

Added blank line to fix issue with travis CI
# Cannot calculate eigenvectors if number of unique words in text < 3. Warns user to add more text. The function ends.
if len(graph.nodes()) < 3:
logger.warning("Please add more sentences to the text. The number of reachable nodes is below 3")
return
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match the function signature (Returns a list). Either raise an exception, or return an empty list -- this is just nasty unexpected gotcha for users.

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.

3 participants