dates

Expand date expressions into spoken form for TTS.

async pipecat.utils.text.transforms.dates.normalize_dates(text: str, aggregation_type: str | AggregationType) str[source]

Expand date expressions to their spoken form.

Handles ISO format (YYYY-MM-DD) and US format (MM/DD/YYYY or MM-DD-YYYY).

Parameters:
  • text – Input text possibly containing date expressions.

  • aggregation_type – Aggregation type of the text frame (unused).

Returns:

Text with date expressions replaced by spoken equivalents.

Example:

result = await normalize_dates("Meeting on 2023-05-10", "*")
# "Meeting on May 10th, two thousand and twenty three"