-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
NLP Word Frequency Algorithms #2142
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
Conversation
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.
https://travis-ci.com/github/TheAlgorithms/Python/builds/172385776#L804
Please fix your code for passing unit tests for further review.
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Hey @danmurphy1217, TravisCI finished with status TravisBuddy Request Identifier: 49fd52f0-b4cf-11ea-bd89-f57d85bb28d1 |
Hey @danmurphy1217, TravisCI finished with status TravisBuddy Request Identifier: 25c1c850-b4d2-11ea-bd89-f57d85bb28d1 |
Travis tests have failedHey @danmurphy1217, TravisBuddy Request Identifier: 017458d0-b4d4-11ea-bd89-f57d85bb28d1 |
Travis tests have failedHey @danmurphy1217, TravisBuddy Request Identifier: 13ea6f70-b4db-11ea-bd89-f57d85bb28d1 |
Hey @danmurphy1217, TravisCI finished with status TravisBuddy Request Identifier: fa991780-b4ec-11ea-bd89-f57d85bb28d1 |
Travis tests have failedHey @danmurphy1217, TravisBuddy Request Identifier: 75e8dcc0-b4ef-11ea-bd89-f57d85bb28d1 |
On your local machine, try: |
Hey @danmurphy1217, TravisCI finished with status TravisBuddy Request Identifier: a49a18d0-b568-11ea-aae7-0b05fcc524af |
Are there any other updates I should make? |
return idf | ||
except ZeroDivisionError: | ||
print("The term you searched for is not in the corpus.") | ||
|
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.
if raise this function not returning float
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.
what do you mean? instead of print raise an error?
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.
If error raised None
will be returned. Is it good way? Wouldn't be better to check df value before calculation and raise error if df==0
?. Also please add doctest with this situation.
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.
Yes. Algorithm functions should not print as discussed in CONTRIBUTING.md. If our type hints promise that we will return a float then we should do so or raise an exception explaining why we can not do so.
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* NLP Word Frequency Algorithms * Added type hints and Wikipedia link to tf-idf * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Fix line length for flake8 * Fix line length for flake8 V2 * Add line escapes and change int to float * Corrected doctests * Fix for TravisCI * Fix for TravisCI V2 * Tests passing locally * Tests passing locally * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update machine_learning/word_frequency_functions.py Co-authored-by: Christian Clauss <cclauss@me.com> * Add doctest examples and clean up docstrings Co-authored-by: Christian Clauss <cclauss@me.com>
Describe your change:
frequency
Checklist:
Fixes: #{$ISSUE_NO}
.