PronunciationRule

sealed interface PronunciationRule

Type-safe pronunciation rule for the BetterFrenchTts dictionary.

Each rule maps a word to either a simple text alias or an exact IPA transcription. A single word can only have one active rule — adding a new rule for the same word replaces the previous one, preventing silent conflicts.

Usage

// Simple alias — the TTS reads "Oua-ouei" instead of "Huawei"
tts.addPronunciation(PronunciationRule.Alias("Huawei", "Oua-ouei"))

// IPA — exact phonetic control
tts.addPronunciation(PronunciationRule.Ipa("Huawei", "wa.wɛj"))

See also

Inheritors

Types

Link copied to clipboard
data class Alias(val word: String, val readAs: String) : PronunciationRule

Simple text substitution. Generates an SSML <sub alias="..."> tag.

Link copied to clipboard
data class Ipa(val word: String, val ipa: String) : PronunciationRule

IPA phonetic transcription. Generates an SSML <phoneme alphabet="ipa" ph="..."> tag.

Properties

Link copied to clipboard
abstract val word: String

The word to match in the input text (case-insensitive).