acronyms
Normalize acronyms so TTS pronounces each letter individually.
- async pipecat.utils.text.transforms.acronyms.normalize_acronyms(text: str, aggregation_type: str | AggregationType) str[source]
Insert spaces between letters of uppercase acronyms.
This transformer is alphanumeric-preserving: the same letters are kept, only spaces are added between them, so the
WordCompletionTrackerrequires no segment-map overhead.- Parameters:
text – Input text possibly containing acronyms like API or HTTP.
aggregation_type – Aggregation type of the text frame (unused).
- Returns:
Text with acronyms letter-spaced (e.g.
"API"→"A P I").
Example:
result = await normalize_acronyms("Use the API or HTTP endpoint", "*") # "Use the A P I or H T T P endpoint"