main : add option for word-leve timestamps (very experimental)

This commit is contained in:
Georgi Gerganov
2022-10-30 10:05:58 +02:00
parent 5a9e4260a6
commit 57fb46f307
3 changed files with 430 additions and 4 deletions

View File

@@ -72,8 +72,9 @@ extern "C" {
whisper_token id; // token id
whisper_token tid; // forced timestamp token id
float p; // probability of the token
float pt; // probability of the timestamp token
float p; // probability of the token
float pt; // probability of the timestamp token
float ptsum; // sum of probabilities of all timestamp tokens
};
// Allocates all memory needed for the model and loads the model from the given file.
@@ -241,6 +242,10 @@ extern "C" {
WHISPER_API const char * whisper_full_get_token_text(struct whisper_context * ctx, int i_segment, int i_token);
WHISPER_API whisper_token whisper_full_get_token_id (struct whisper_context * ctx, int i_segment, int i_token);
// Get token data for the specified token in the specified segment.
// This contains probabilities, timestamps, etc.
WHISPER_API struct whisper_token_data whisper_full_get_token_data(struct whisper_context * ctx, int i_segment, int i_token);
// Get the probability of the specified token in the specified segment.
WHISPER_API float whisper_full_get_token_p(struct whisper_context * ctx, int i_segment, int i_token);