Documentation
¶
Overview ¶
Command features-text-transforms composes individual built-in text transforms instead of using the VoiceFormatter bundle, for fine-grained control over which transforms apply and in what order.
Each transform rewrites the text of a unit. They are registered on the TTS service as TextTransformers, each pairing a transform with the text type it applies to (frames.AnyTextType for all of them).
The same transformers registered on an LLMText processor rewrite the text for everyone downstream (the voice, the context and the client) rather than for the voice alone. This example strips emoji there, so the LLM never sees its own emoji in the context and keeps adding more.
It is a billing assistant composing several transforms:
StripMarkdown remove bold, italic and headers the LLM might add NormalizeAcronyms "API" → "A P I" EmailToSpeech "user@example.com" → "user at example dot com" ExpandCurrency "$42.50" → "forty-two dollars and fifty cents" ExpandPercentages "3.5%" → "three point five percent" ReplaceText custom substitutions (e.g. "Dr." → "Doctor") CARTESIA_API_KEY=… ELEVENLABS_API_KEY=… ELEVENLABS_VOICE_ID=… \ OPENAI_API_KEY=… go run ./examples/features/features-text-transforms
Then open http://localhost:7860 and connect.