INNER CODE UNIT · TypeScript
joinWords
iurysza/module-graph · .agents/skills/audio-transcribe/scripts/transcribe.ts:192
function joinWords(words: string[]): string {
return words
.join(" ")
.replace(/\s+([,.;:!?])/g, "$1")
.replace(/([([{])\s+/g, "$1")
.replace(/\s+([)\]}])/g, "$1");
}
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;