INNER CODE UNIT · TypeScript
extractWordAnnotations
iurysza/module-graph · .agents/skills/audio-transcribe/scripts/transcribe.ts:200
export function extractWordAnnotations(response: TranscriptionResponse): WordAnnotation[] {
const words: WordAnnotation[] = [];
for (const step of response.steps ?? []) {
for (const content of step.content ?? []) {
for (const annotation of content.annotations ?? []) {
if (annotation.type === "word_info") words.push(annotation);
}
}
}
return words;
}
export function formatStructuredTranscript(
annotations: WordAnnotation[],
offsetSeconds: number,
): string {
const groups: Array<{ speaker: string; startSeconds: number; words: string[] }> = [];
const timestampedAnnotations = annotations