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

Add verification when summarize_corpus returns null. Fix #1531. #1570

Merged
merged 5 commits into from
Sep 18, 2017

Conversation

fbarrios
Copy link
Contributor

@fbarrios fbarrios commented Sep 5, 2017

No description provided.

# If couldn't get important docs, the algorithm ends.
if not most_important_docs:
logger.warning("Couldn't get relevant sentences.")
return
Copy link
Owner

Choose a reason for hiding this comment

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

Raising an exception better? I'm not sure whether this is an error state, or just a warning.

Many people don't have logging enabled, and the docstring implies the result of this function is a string (not None).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is an error. Perhaps it makes even more sense to actually return the entire text as the summary wasn't possible, but this will break compatibility with the old behavior.

Regarding the docstring, the method returns a string or a list if the split parameter was set to true, so perhaps the best thing to do is:

if not most_important_docs:
    logger.warning("Couldn't get relevant sentences.")
    return [] if split else ""

Copy link
Owner

@piskvorky piskvorky Sep 7, 2017

Choose a reason for hiding this comment

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

That looks like a good solution 👍
Except we probably want to work with unicode in general ("" => u"", if the rest of the code uses proper unicode too).

CC @menshikh-iv

fbarrios and others added 2 commits September 9, 2017 11:11
- Returns empty list on border case of summarize_corpus.
- Returns empty string or empty list on border case of summarize.
- Fixed test accordingly.
- Removed some test code repetition.
@menshikh-iv menshikh-iv changed the title Add verification when summarize_corpus returns null (Fixes #1531) Add verification when summarize_corpus returns null. Fix #1531. Sep 14, 2017
@menshikh-iv
Copy link
Contributor

Thank you @fbarrios

@menshikh-iv menshikh-iv merged commit 02ba343 into piskvorky:develop Sep 18, 2017
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