from whisper_normalizer.basic import BasicTextNormalizer
normalizer = BasicTextNormalizer()
normalizer("I'm a little teapot, short and stout. Tip me over and pour me out!")'i m a little teapot short and stout tip me over and pour me out '
A Python package for text normalization/standardisation for ASR evaluation and TTS. It implements the Whisper normalizer and provides language-aware normalizers for 101 languages, including dedicated Indic and international support. Indic normalization is derived from indic-nlp-library.
Based on the text normalization approach from OpenAI Whisper; see Appendix C of Robust Speech Recognition via Large-Scale Weak Supervision. Full documentation: kurianbenoy.github.io/whisper_normalizer.
Or install from GitHub:
Use Normalizer to select a language-aware normalizer:
EnglishTextNormalizer and BasicTextNormalizer are also available as direct classes:
The package covers 101 languages in three tiers. Dedicated and script-tier normalizers:
| Language | Code | Normalizer | Tier | Digits → words | Marks | tts_mode |
|---|---|---|---|---|---|---|
| Arabic | ar |
ArabicTextNormalizer |
dedicated | tts_mode | stripped | yes |
| Bengali | bn |
BengaliNormalizer |
dedicated | always | kept | yes |
| Chinese | zh |
ChineseTextNormalizer |
dedicated | never | kept | no |
| English | en |
EnglishTextNormalizer |
dedicated | tts_mode | stripped | yes |
| French | fr |
FrenchTextNormalizer |
dedicated | tts_mode | kept | yes |
| Gujarati | gu |
GujaratiNormalizer |
dedicated | always | kept | yes |
| Hindi | hi |
HindiNormalizer |
dedicated | always | kept | yes |
| Kannada | kn |
KannadaNormalizer |
dedicated | always | kept | yes |
| Malayalam | ml |
MalayalamNormalizer |
dedicated | always | kept | yes |
| Odia | or |
OdiaNormalizer |
dedicated | always | kept | yes |
| Punjabi | pa |
PunjabiNormalizer |
dedicated | always | kept | yes |
| Russian | ru |
RussianTextNormalizer |
dedicated | tts_mode | kept | yes |
| Spanish | es |
SpanishTextNormalizer |
dedicated | tts_mode | kept | yes |
| Tamil | ta |
TamilNormalizer |
dedicated | always | kept | yes |
| Telugu | te |
TeluguNormalizer |
dedicated | always | kept | yes |
| Assamese | as |
BengaliNormalizer |
script | always | kept | yes |
| Marathi | mr |
DevanagariNormalizer |
script | always | kept | yes |
| Nepali | ne |
DevanagariNormalizer |
script | always (Hindi number words) | kept | no |
| Sanskrit | sa |
DevanagariNormalizer |
script | always (Hindi number words) | kept | no |
The other 82 languages use the generic tier: Unicode NFC, brackets and punctuation removed, case folded, combining marks kept. Digits become words only with tts_mode=True, which 33 of them support.
Normalizer(code) exposes .tier and .capabilities, while supported_languages() returns the full list.
Whisper’s BasicTextNormalizer can strip combining marks and is not recommended for Indic languages; see Dr Kavya Manohar’s post. Use a dedicated Indic normalizer or BasicTextNormalizer(preserve_marks=True), which keeps vowel signs, viramas and other combining marks.
For example:
tts_mode=True produces speakable text by expanding numbers, currency, decimals, URLs, emails, symbols and acronyms. It is available for many languages, including English, French, Spanish, Arabic and Russian, and needs the optional dependency:
Unsupported options raise ValueError.
If you use whisper_normalizer in your work and would like to cite it, please thank Kurian Benoy and link to this GitHub repository: github.com/kurianbenoy/whisper_normalizer.