This release is a pre-release and may not be stable for production use.
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.
| Written | Spoken (en-GB) |
|---|---|
Dr Smith paid £3.50 for 2 tickets on 14 March 2024. |
Doctor Smith paid three pounds and fifty pence for two tickets on the fourteenth of March twenty twenty-four. |
Install
uv pip install --prerelease=allow text2spoken
The library needs Python 3.11 or later. It uses no network and loads no model. English and German need no extra. The other languages take their number words from an extra:
uv pip install --prerelease=allow "text2spoken[pt]" # also ar, es, eu, ru
Quickstart
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.'
The second argument is a BCP 47 language tag. It selects the language and the variety, so en-US reads 03/04/2025 as month, day, year, and en-GB reads it as day, month, year.
Where this fits
Alone: rewrite text into spoken words before a voice, a phonemizer or a word error rate score reads it, with from text2spoken import normalize.
In the stack: the normalisation stage. A phonemizer library or a TTS frontend calls normalize first and phonemizes its output. text2spoken calls no phonemizer and no model.
Through scriptconv: uv pip install --prerelease=allow "scriptconv[normalize]".
Languages
Each language is one file in text2spoken/lang/. A tag with no file reads cardinal numbers from the CLDR spell-out rules, where CLDR has rules for that language.
| Language | Varieties | Extra |
|---|---|---|
| Arabic | ar-001 and ten regional tags. 25 Arabic varieties of ISO 639-3, such as arz and ary, read as ar |
ar |
| German | de-DE, de-AT, de-CH |
none |
| English | en-GB, en-US |
none |
| Spanish | es-ES, es-419, es-MX, es-AR, es-US and eight other American varieties |
es |
| Basque | eu-ES |
eu |
| Portuguese | pt-PT, pt-BR |
pt |
| Russian | ru-RU |
ru |
Documentation
| Page | What it tells you |
|---|---|
| Docs index | The map of the docs |
| Quickstart | Install, the first call, and how to see what a tag reads |
| Usage | Text to speech, phonemizers and word error rate, with examples |
| How it reads text | Each written form, what it reads, and which forms are off by default |
| API | normalize, analyze, render, supports, effective_params, the params, hints and tokenizers |
| Errors and warnings | Each error and warning, strict mode, and when a reading stays as written |
| Adding a language | The contract of a language file |
| Development | The tests, the row files and CI |
Licence
Apache-2.0. See LICENSE. The CLDR data in text2spoken/data/cldr/ ships under the Unicode License v3, in its own licence file.
The changes of each release are in CHANGELOG.md.
Metadata
Release files for text2spoken 0.0.2a52
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| text2spoken-0.0.2a52.tar.gz | 440.5 kB | Without provenance | Details for text2spoken-0.0.2a52.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| text2spoken-0.0.2a52-py3-none-any.whl | Python 3 | none | any | Details for text2spoken-0.0.2a52-py3-none-any.whl |
Total release size: 823.9 kB
Release files / text2spoken-0.0.2a52.tar.gz
| Download URL | text2spoken-0.0.2a52.tar.gz |
|---|---|
| Size | 440.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
294901f72e93eaaa2fe1d0ecc4b5a2323c821d21bacd773e03a6cc1fae75f67a
|
|
BLAKE2b-256 checksum How to use checksums |
71f549700eb895977c2019d949cde5ab163d995b31c648f1c5a46d00ab016a0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / text2spoken-0.0.2a52-py3-none-any.whl
| Download URL | text2spoken-0.0.2a52-py3-none-any.whl |
|---|---|
| Size | 383.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c20da20bac0b1da364edb1be36a1f6de8eba21939f5f001e8291948b41c651fa
|
|
BLAKE2b-256 checksum How to use checksums |
d4c413db576c7e4821016745d4d400569294a8e8262c63520887abec1c14b899
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for text2spoken 0.0.2a52
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.