Convert numbers, dates, unit abbreviations, and currency amounts in English text to their full descriptive word forms.
Useful as a preprocessing step before machine translation, TTS, or any NLP pipeline where raw digits and abbreviations should be spoken out.
pip install num2descRequires Python 3.10+ and depends on num2words.
from num2desc import normalize
# Standalone numbers
normalize("there are 42 items")
# → "there are forty-two items"
# Dates
normalize("born on January 15, 1990")
# → "born on the fifteenth of January in the year nineteen ninety"
normalize("on 15th March, 2023")
# → "on the fifteenth of March in the year twenty twenty-three"
# Ordinals
normalize("1st place, 2nd place, 3rd place")
# → "first place, second place, third place"
# Currency (symbols & codes)
normalize("cost $50")
# → "cost fifty US dollars"
normalize("cost GHS 200")
# → "cost two hundred Ghana cedis"
normalize("raised $2 million")
# → "raised two million US dollars"
# Percentages
normalize("rate is 25%")
# → "rate is twenty-five percent"
# Abbreviated units
normalize("run 5 km")
# → "run five kilometers"
normalize("weight 1.5 kg")
# → "weight one point five kilograms"
# All patterns in one call
normalize("On 5 July, 2024, GHS 1.5 million was allocated for 500 km of roads. That's 15% of the budget.")
# → "On the fifth of July in the year twenty twenty-four, one point five million Ghana cedis was allocated for five hundred kilometers of roads. That's fifteen percent of the budget."pip install -e ".[dev]"
pytest tests/MIT