Remove empty elements from exploded character-ngrams output - #15371
Merged
Conversation
davidwendt
marked this pull request as ready for review
March 25, 2024 14:32
bdice
approved these changes
Apr 1, 2024
vyasr
approved these changes
Apr 4, 2024
Contributor
Author
|
/merge |
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.
Description
Fixes
character_ngramsfunction to not include empty entries whenas_list=False. That is, the exploded view (non-list result) should not contain empty or NA elements.This PR changes the
nvtext::generate_character_ngrams()API to return a lists column instead of a flat strings column. The python code had been converting the return object into lists column and then exploding it ifas_list=False. Returning as a list column simplifies the logic and prevents the double conversion. There is almost no impact to the nvtext code since the offsets for the output lists column were already being generated.All tests were updated to expect the new result. Also changed some exception types from
cudf::logic_errortostd::invalid_argumentas appropriate.Continues work of abandoned PR #14685
Checklist