Skip to content

Function: wordsFromTokenLogprobs()

wordsFromTokenLogprobs(text, raw): SttWord[] | undefined

Defined in: openai.ts:75

Fold OpenAI's TOKEN-level transcription logprobs into WORD-level SttWords (no timestamps on this wire). A word's confidence is its WORST token (min logprob) — one unsure token is what makes a word worth re-speaking; averaging would hide it. Tolerant by design: malformed input → undefined, and any drift between token concatenation and the final text degrades to no words rather than mislabeling them.

(Ported verbatim from the channel — the ~40-line copy the aiui-stt proposal's open question 3 predicted would be cheaper than a shared package. Divergence is guarded by both packages' tests.)

Parameters

text

string

raw

unknown

Returns

SttWord[] | undefined