feat: add new option "return_segments" to allow accessing word probabilities and other meta information #75
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.
Currently RealtimeSTT doesn't expose the meta information about segments and their words, which are otherwise available when passing
word_timestamps=True
to the faster-whisper model. This information is very nice to have when building an application on top of RealtimeSTT, since it allow displaying word detection certainties, or to align words temporally.This introduces a new option
return_segments
that enablesword_timestamps=True
on both the realtime and main model, and causes the related functions to take a tuple(text, segments)
instead of justtext
. This change is opt-in and fully backward compatible.