Rewrite written forms into the words a speaker says: numbers, dates, times, money, units and more, one file per language
Maintained. Last release today, commits in 4 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install text2spokenREADME as published on PyPI with version 0.0.2a235.
text2spoken
text2spoken rewrites written text into the words that a person says when they read it aloud. It reads numbers, dates, times, money, measures, percentages, telephone numbers, colours, abbreviations, and e-mail and web addresses. The rest of the text stays as it is, character for character. It uses no network and no model.
Try it in the browser: text2spoken on Hugging Face, with examples for each language.
Quickstart
uv pip install --prerelease=allow text2spoken
>>> from text2spoken import normalize
>>> normalize("Dr Smith paid £3.50 for 2 tickets on 14 March 2024.", "en-GB")
'Doctor Smith paid three pounds and fifty pence for two tickets on the fourteenth of March twenty twenty-four.'
>>> normalize("Meet on 03/04/2025 at 7:30 pm.", "en-US")
'Meet on March fourth twenty twenty-five at seven thirty PM.'
>>> normalize("O Dr. Silva pagou 2,50 € às 14:30.", "pt-PT")
'O Doutor Silva pagou dois euros e cinquenta cêntimos às catorze e trinta.'
The second argument is a BCP 47 tag. It selects the language file and the variety. The library needs Python 3.11 or later. Every language reads with the base install.
Find your answer
| You want to | Read |
|---|---|
| Install it and make a first call | Quickstart |
| Turn a form off or on, or add your own words | Usage |
Read a form that SSML say-as markup names | API, say_as |
| Know why a text reads as it does | How it reads text |
| See which forms each language reads | Languages at a glance |