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

🥅 Handle empty text for filtered span classification #304

Merged
merged 3 commits into from
Jan 17, 2024

Conversation

evaline-ju
Copy link
Collaborator

Return empty classification results when classification is invoked with empty text or empty text stream. This would prevent potential further errors that may incur if any models used (tokenizers or classifiers cannot handle empty strings properly). Empty text could have been considered an error but based on current usage this would not be a desired user experience

if threshold is None:
threshold = self.default_threshold
if text == "":
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a reason to not throw error on this? is that for compatibility with TGIS?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes as noted in the PR description the current usage is usually to send generated text (from TGIS) directly to classification

Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Is it worth just using the native "truthiness" of text here (if not text)?

Signed-off-by: Evaline Ju <[email protected]>
Copy link
Collaborator

@gkumbhat gkumbhat left a comment

Choose a reason for hiding this comment

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

LGTM

@gkumbhat gkumbhat merged commit 6bc17e2 into caikit:main Jan 17, 2024
5 checks passed
@gkumbhat gkumbhat deleted the empty-text branch January 17, 2024 17:03
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