NLP Word Frequency Algorithms#2142
NLP Word Frequency Algorithms#2142l3str4nge merged 21 commits intoTheAlgorithms:masterfrom danmurphy1217:dan
Conversation
l3str4nge
left a comment
There was a problem hiding this comment.
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.
if raise this function not returning float
There was a problem hiding this comment.
what do you mean? instead of print raise an error?
There was a problem hiding this comment.
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.
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}.