phone
Expand phone numbers into space-separated digit sequences for TTS.
- async pipecat.utils.text.transforms.phone.expand_phone_numbers(text: str, aggregation_type: str | AggregationType) str[source]
Space out phone number digits so TTS reads them individually.
This transformer is alphanumeric-preserving: digits are kept, only separators change to spaces, so the
WordCompletionTrackerrequires no segment-map overhead.- Parameters:
text – Input text possibly containing phone numbers.
aggregation_type – Aggregation type of the text frame (unused).
- Returns:
Text with phone numbers replaced by space-separated digit sequences.
Example:
result = await expand_phone_numbers("Call 123-456-7890 now", "*") # "Call 1 2 3 4 5 6 7 8 9 0 now"