speechready (Python)
Prepare text for text-to-speech. See the repository README for the project overview.
pip install speechready
Python 3.10 or newer; the only dependency is PyYAML. Try it without installing at berkerbatur.github.io/speechready/play.
Usage
from speechready import prepare
result = prepare(
"**Step 1:** run `npm install`. [pause 1s] Then read https://example.com/docs.",
provider="elevenlabs",
model="eleven_multilingual_v2",
locale="en-US",
)
result.text # 'Step 1: run npm install. <break time="1s" /> Then read example.com.'
result.chunks # the same text split under the model's request limit
for change in result.changes:
print(change.rule, repr(change.before), "->", repr(change.after))
The verbalize stage rewrites only what models misread: phone numbers and long digit strings (digit by digit), numeric dates in the locale's order, 24-hour times, currency amounts, percent and unit abbreviations, small fractions, number ranges, years in context, decades, ordinals, and identifiers such as AB12X9. Ordinary numbers, decimals and pronounceable names like COVID-19 are left alone.
Turkish (locale="tr-TR") adds what foreign models get wrong in Turkish: suffixes on numerals and abbreviations are joined to the spoken word with vowel harmony and buffer consonants (3'te → üçte, 1990'da → bin dokuz yüz doksanda, 100 TL'ye → yüz liraya, 1/4'ü → çeyreği), %50 → yüzde elli, dotted thousands 1.250 → bin iki yüz elli, decimal commas 3,14 → üç virgül on dört, 3. madde → üçüncü madde, dates 27.10.2026 → yirmi yedi Ekim iki bin yirmi altı, and abbreviations such as vb., Dr., Üniv., Cad. read in full.
Inline intents in the input: [pause 500ms], [pause 1.5s], [spell AB12], [em really]. An SSML <break time="..."/> you already have is read as a pause intent and re-rendered for the target.
provider and model pick a profile from spec/profiles; with neither, the plain profile renders pauses as punctuation and returns one chunk. Pass profile=load_profile("azure-neural") to pick one directly and limit= to override the request limit.
Everything a caller may want to decide differently is an Options field, and the defaults are what the evaluation ran with:
from speechready import Options, prepare
prepare(text, provider="openai", options=Options(
code_blocks="keep", # drop (default) | keep: read fenced code aloud | mention: one sentence stands in for it
code_block_mention=None, # what `mention` says; None = "See the code block." / "Kod bloğuna bakın."
tables="rows", # rows (default, each row a comma list) | drop
urls="domain", # domain (default) | drop | keep
emails="keep", # keep (default) | drop
emoji="drop", # drop (default) | keep
emphasis="strip", # strip (default) | intent: **bold** becomes an emphasis intent
list_numbers="keep", # keep (default, "1. Open the app") | drop
fractions="spoken", # spoken (default: "one half", "yarım") | division ("one over two", "bir bölü iki")
foreign_acronyms=True, # Turkish: npm, css, sql read with English letter names (en pi em)
terminal_punctuation=".", # added to a block that ends without one
))
Phone numbers follow each language's habit: English reads digit by digit with a pause between groups, Turkish reads each group as a number (0532 123 45 67 → sıfır beş yüz otuz iki, yüz yirmi üç, kırk beş, altmış yedi).
Pronunciation lexicon, one file for every vendor:
from speechready import Lexicon, prepare, load_profile
lex = Lexicon.load("examples/lexicon.en.yaml") # entries with ipa, say or spell
prepare("Restart Nginx.", provider="azure", lexicon=lex).text
# 'Restart <phoneme alphabet="ipa" ph="ˈɛndʒɪnˈɛks">Nginx</phoneme>.'
prepare("Restart Nginx.", provider="openai", lexicon=lex).text
# 'Restart engine X.' (no phoneme tags on OpenAI, so the respelling is used)
lex.to_pls() # PLS XML for ElevenLabs, Azure and Polly uploads
lex.to_google_json() # Google Cloud TTS custom pronunciations
lex.export_for(load_profile("elevenlabs-v2")) # the right one for a profile, or None
An inline [ipa Nginx ˈɛndʒɪnˈɛks] tag does the same for one word without a file.
Streaming:
from speechready import Segmenter
seg = Segmenter(locale="en-US")
for token in llm_stream:
for sentence in seg.push(token):
tts.say(prepare(sentence, provider="openai").text)
for sentence in seg.flush():
tts.say(prepare(sentence, provider="openai").text)
Development
cd python
python -m pip install -e ".[dev]"
pytest
Tests run every fixture in ../spec/fixtures, which the JavaScript package must pass as well.
Metadata
Release files for speechready 0.1.0
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 |
|---|---|---|---|---|
| speechready-0.1.0.tar.gz | 32.4 kB | With provenance | Details for speechready-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| speechready-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for speechready-0.1.0-py3-none-any.whl |
Total release size: 75.9 kB
Release files / speechready-0.1.0.tar.gz
| Download URL | speechready-0.1.0.tar.gz |
|---|---|
| Size | 32.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f3093e015cafb1e76fd7b4efcf8c42d529183bde9175550d79966470dd0f445
|
|
BLAKE2b-256 checksum How to use checksums |
38490798f78fb2a4160e01beca518c7193bf424da8db7109dddd5efb7a8151d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / speechready-0.1.0-py3-none-any.whl
| Download URL | speechready-0.1.0-py3-none-any.whl |
|---|---|
| Size | 43.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb274aa0b9ce23a55b1fdd0a2c48afb88d881f1ccfd53fbbb1b246612e51315f
|
|
BLAKE2b-256 checksum How to use checksums |
ad95b95a8ddb587593eef40a33690db3834af1fb86c6c7b608b653b61b156785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for speechready 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for speechready-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA 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.