percentages
Expand percentage expressions into spoken form for TTS.
- async pipecat.utils.text.transforms.percentages.expand_percentages(text: str, aggregation_type: str | AggregationType) str[source]
Expand percentage expressions to their spoken form.
- Parameters:
text – Input text possibly containing percentage expressions.
aggregation_type – Aggregation type of the text frame (unused).
- Returns:
Text with percentages replaced by spoken equivalents.
Example:
result = await expand_percentages("50% off today", "*") # "fifty percent off today"