Last active
December 19, 2025 13:53
-
-
Save CodeWithOz/d254c811d5a20c2083f593d0a856f875 to your computer and use it in GitHub Desktop.
TTS logic for Listen Better demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function generateExplanationScript( | |
| processedSentence: ProcessedSentenceResult | |
| ): string[] { | |
| const { sentence, translatedText, verbs, vocabulary, idiomaticExpressions } = | |
| processedSentence; | |
| const explanationParts: string[] = []; | |
| // start by reading out the sentence | |
| explanationParts.push( | |
| `${PRESENTERS.MARIE.name}: [cheerfully] Bonjour à tous et à toutes ! Aujourd'hui, nous allons apprendre à traduire la phrase suivante, dans trois, deux, un [short pause]: « [very slowly for emphasis] ${sentence} ».` | |
| ); | |
| // pass to the other speaker | |
| explanationParts.push( | |
| `${PRESENTERS.MARIE.name}: [short pause] [warmly] Alors, Clément, qu'est-ce que tu penses de cette phrase ?` | |
| ); | |
| // then read out the translation | |
| explanationParts.push( | |
| `${PRESENTERS.CLEMENT.name}: [warmly] Bien, cette phrase veut dire [short pause]: "[English explanation] ${translatedText}". [short pause] And what can you tell us about the verbs used in this sentence, Marie?` | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment