Fix delimiter inconsistency in Natural Language primitives#2423
Merged
Fix delimiter inconsistency in Natural Language primitives#2423
Conversation
sbadithe
commented
Dec 20, 2022
featuretools/primitives/standard/transform/natural_language/number_of_common_words.py
Show resolved
Hide resolved
…o fix-delimiter-inconsistency
…o fix-delimiter-inconsistency
sbadithe
commented
Dec 22, 2022
| The default delimiters include [-.!?]\n\t | ||
|
|
||
| Examples: | ||
| >>> x = ['This is a test file', 'This is second line', 'third line $1,000', None] |
Contributor
Author
There was a problem hiding this comment.
previous primitive behavior was to break up "$1,000" into "$1" and "000". After this change, it stays as one word
Codecov Report
@@ Coverage Diff @@
## main #2423 +/- ##
=======================================
Coverage 99.44% 99.44%
=======================================
Files 340 340
Lines 20870 20870
=======================================
Hits 20755 20755
Misses 115 115
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
rwedge
reviewed
Dec 22, 2022
Contributor
rwedge
left a comment
There was a problem hiding this comment.
For NumberOfUniqueWords should we test for \t somewhere?
featuretools/primitives/standard/transform/natural_language/constants.py
Outdated
Show resolved
Hide resolved
featuretools/primitives/standard/transform/natural_language/total_word_length.py
Show resolved
Hide resolved
b0af6b1 to
031daee
Compare
rwedge
reviewed
Dec 28, 2022
gsheni
approved these changes
Jan 3, 2023
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #2419
closes #2425
closes #2426
Changes:
After this change, the default delimiters for all primitives are only whitespace, unless manually overrided. This means primitives will leave words like "alteryx.com" and "1,000" as one word, unless explicitly told not to.
This results in adjusting test cases for some primitives. Furthermore, it results in a change to NumberOfCommonWords where words are split on whitespace and then stripped of punctuation before being checked for membership in the common word set.