Text normalization
Use normalize_text() to inspect spoken text before generation.
from kittentts import normalize_text
spoken = normalize_text("Dr. Rivera paid $12.50 at 3:05 p.m.")
print(spoken)
The normalization pipeline handles common English forms including:
- integers, decimals, scientific notation, and scale suffixes;
- ordinals, Roman numerals, ranges, fractions, and decades;
- currency, percentages, units, phone numbers, and IP addresses;
- times, versions, email addresses, and URLs;
- abbreviations, punctuation, Unicode, and whitespace.
Track changed spans
Set return_spans=True to receive normalized text plus original-to-normalized ranges for changed segments.
result = normalize_text("Fig. 2 costs $5", return_spans=True)
print(result.text)
for span in result.spans:
print(span)
This is useful for editor previews or highlighting what the TTS engine will read differently.
Generate normalized input
audio = tts.generate(
"Version 2.1 costs $19.99.",
voice="Bella",
clean_text=True,
)
Normalize once. Do not call normalize_text() yourself and then pass clean_text=True unless you intentionally want the pipeline to process the already-normalized string again.
The current locale argument defaults to en-US; the v0.8 models and pipeline are English-focused.