(words: Word[], onsetSeconds: number)
| 482 | * Whisper can hallucinate words over non-speech sections at the start of audio. |
| 483 | */ |
| 484 | export function stripBeforeOnset(words: Word[], onsetSeconds: number): Word[] { |
| 485 | // 0.5s tolerance: keep words whose timestamps straddle the onset boundary, |
| 486 | // since whisper may assign a slightly early start to the first spoken word. |
| 487 | return words.filter((w) => w.start >= onsetSeconds - 0.5); |
| 488 | } |
| 489 | |
| 490 | export function patchCaptionHtml(dir: string, words: Word[]): void { |
| 491 | if (words.length === 0) return; |
no outgoing calls
no test coverage detected