Skip to main content

Speakable

Text normalization for voice agents. Turn LLM output into text a TTS engine speaks correctly.

Your LLM returns this:

**Invoice #42**: $1,234.56 due 2026-11-11. Call Dr. Rao at (555) 123-4567
before 3:30 PM. Save 15%! 🎉

Your TTS engine says "asterisk asterisk invoice hash forty two asterisk asterisk colon dollar one comma two three four point five six..."

Speakable returns this:

Invoice number forty-two: one thousand two hundred thirty-four dollars and
fifty-six cents due November eleventh, twenty twenty-six. Call Doctor Rao at
five five five one two three four five six seven before three thirty PM.
Save fifteen percent!

Pure Python, zero dependencies in the core, ~1.5 ms for a typical utterance.

Install

pip install speakable
from speakable import normalize

normalize("Pay $20 by 2026-01-05.")
# 'Pay twenty dollars by January fifth, twenty twenty-six.'

On PyPI · Python 3.9+ · zero dependencies · MIT.

Try it without installing anything

https://divyajeet01.github.io/speakable/ - paste your own text and watch it get fixed. The whole library is compiled into the page, so nothing you paste leaves your browser.

What it handles

Input Output
**bold**, # heading, `code`, [link](url), **unclosed stripped to plain text
$1,234.56 · $1.5M · $.50 · USD 50 · ₹500 one thousand two hundred thirty-four dollars and fifty-six cents, one point five million dollars, fifty cents, fifty US dollars
2026-11-11, Nov 11, 2026, 12/25 November eleventh, twenty twenty-six, December twenty-fifth
3:30 PM, 14:00, 9:05 a.m. three thirty PM, two o'clock PM, nine oh five AM
(555) 123-4567, 555-0100, x204 digit by digit, the way a human reads a number aloud
15%, 10%-20% fifteen percent, ten percent to twenty percent
1 kg, 5kg, 3hrs, 10 min one kilogram, five kilograms, three hours, ten minutes — singular when there is one
1st, 3/4, 24/7, 4.5/5, 3:1 first, three quarters, twenty four seven, four point five out of five, three to one
10-20, 2026-2027, -45 ten to twenty, twenty twenty-six to twenty twenty-seven, negative forty-five
20°C, 90°, 3x, 2x4 twenty degrees Celsius, ninety degrees, three times, two by four
0042, 00123 read out digit by digit — a PIN is not a quantity
Dr., Inc., etc., U.S., Ph.D., Mon. Doctor, Incorporated, et cetera, U S, P H D, Monday
john@example.com, acme.io/docs john at example dot com, acme dot io
192.168.1.1, v1.2.3 read as an address and a version, not a phone number
🎉 · — · “ ” · • emoji removed; em dash becomes a comma pause; the rest normalised
API (opt-in) A P I, skipping acronyms TTS already says right

The whole API

normalize(text, spell_acronyms=False, strip_emoji=True) -> str

One function, two options, and it is idempotent — running it twice changes nothing, so it is safe on text that may already have been through it.

normalize("The API is up", spell_acronyms=True)   # 'The A P I is up'
normalize("Ready 🚀 to go", strip_emoji=False)     # 'Ready 🚀 to go'

A string in, a string out, with no runtime dependencies — so it drops into any agent loop, streaming callback or batch job, with no framework assumed:

LLM  ->  normalize()  ->  TTS  ->  caller

HTTP API

pip install -r requirements.txt
uvicorn app:app --reload          # docs at http://127.0.0.1:8000/docs
curl -X POST http://127.0.0.1:8000/normalize \
  -H 'Content-Type: application/json' \
  -d '{"text": "Pay $20 by 2026-01-05."}'
{
  "text": "Pay twenty dollars by January fifth, twenty twenty-six.",
  "original": "Pay $20 by 2026-01-05.",
  "chars_in": 22,
  "chars_out": 54,
  "took_ms": 0.9
}

POST /normalize/batch takes {"texts": [...]} for up to 100 strings at once. GET /health for liveness.

Set RAPIDAPI_PROXY_SECRET to reject any traffic that didn't come through the marketplace proxy. MAX_CHARS and MAX_BATCH bound request size.

Docker

docker build -t speakable .
docker run -p 8000:8000 speakable

Tests

python tests/test_normalize.py     # 91 cases, no pytest required
python tests/test_parity.py        # the web page vs the library (needs node)

test_parity.py lifts the engine out of docs/index.html and runs it over every case in the suite, so the browser tool and pip install speakable cannot drift apart unnoticed. It reports as skipped when node is not installed.

Why this exists

Every voice agent hits this. The LLM is trained on written English and emits markdown, digits and abbreviations; TTS engines are built for prose. The gap between them is where callers hear "asterisk" out loud. Most teams end up with a pile of ad-hoc regexes that handle their own demo and break on the next one.

This is that pile, written once, tested, and ordered correctly — the ordering is most of the difficulty. Dates have to run before phone numbers, because 2026-11-11 is also digits-and-hyphens. Emails have to run before anything touches a dot. Currency has to run before plain integers.

Not handled (yet)

Non-English locales, lakh/crore wording (₹1,50,000 reads as "one hundred fifty thousand rupees"), roman numerals, mathematical expressions, vanity numbers (1-800-FLOWERS), and bare temperature letters (72F without a degree sign, as likely to be a seat as a temperature). PRs welcome.

Two deliberate calls: an ambiguous a/b is a fraction when the denominator is one a real fraction uses (1/2, 3/4, 5/16) and a date otherwise (12/25, 9/11); and a fraction takes a plural unit, so 3/4 kg is "three quarters kilograms".

Changelog

See CHANGELOG.md. The short version of 1.2.0: twelve bugs where a voice agent said the wrong thing out loud, and the coverage gaps beside them.

License

MIT.

Metadata

Release files for speakable 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speakable 1.2.0
File Size Uploaded Provenance Actions
speakable-1.2.0.tar.gz 22.0 kB Without provenance Details for speakable-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for speakable 1.2.0
File Interpreter ABI Platform Actions
speakable-1.2.0-py3-none-any.whl Python 3 none any Details for speakable-1.2.0-py3-none-any.whl

Total release size: 36.8 kB

Release files / speakable-1.2.0.tar.gz

Download URL speakable-1.2.0.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
da8f286d46e5b6d841b6b69ab8df725153dcc1b2f6509003ec2aa92017eb8660
BLAKE2b-256 checksum
How to use checksums
ddb827fa946b55485a9b9c00838f7f1b8bc1a2cca7f0f71298113894f891d517
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / speakable-1.2.0-py3-none-any.whl

Download URL speakable-1.2.0-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
268f8e420affb027c44e21d5aa09a13fa54e5534fe120d5c3c07990d92d254bb
BLAKE2b-256 checksum
How to use checksums
2671476cd6b20619c93ec5d84100b24843ae83dea870eba021eb03bae1708ae4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Security for speakable 1.2.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.

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page