Skip to main content

ttsready

ttsready is a source-neutral Python library for preparing caller-owned text for speech. prepare_run() is the low-level compiler-facing primitive for already analyzed runs; prepare_text() and prepare_units() provide review-oriented results with changes, issues, context, QA, statistics, and reproducibility fingerprints.

The library does not read or write files, parse SSMD or other formats, expose a CLI, generate audio, or own a document workflow. Callers adapt their source format to TextUnit values and decide what to do with the returned data.

Install

Python 3.10 or newer is required.

python -m pip install ttsready

The runtime dependencies are spokenform>=0.4.6,<0.5 and phrasplit>=0.3.9,<1. Install the optional lexical extra when you need its lexical-evidence integrations:

python -m pip install 'ttsready[lexical]'

Release versioning

setuptools-scm derives TTSReady versions from Git tags and writes ttsready/_version.py during builds. Release tags use vX.Y.Z. A bare source tree without generated SCM metadata reports the neutral version 0+unknown; release artifacts must derive their version from the tag.

Quickstart

from ttsready import prepare_text

prepared = prepare_text("A young reader opened a book.", language="en-US")
print(prepared.spoken_text)

for change in prepared.changes:
    print(change.source, "→", change.replacement, change.source_start, change.source_end)

prepare_text() prepares one unit and returns a PreparedUnit. Use prepare_units() when you have multiple caller-owned units, possibly with different languages, roles, protected spans, or metadata. See docs/quickstart.md and the runnable API example.

prepare_units() can carry a high-confidence initialism pronunciation established in one unit to exact occurrences in the same preparation set; isolated prepare_text() remains conservative. See Python API.

Lexical review

Use review_lexicon() to collect pronunciation-review candidates from caller-owned units. The provider is optional; for example, heuristic candidates can be collected without downloading or loading a dataset:

from ttsready import TextUnit, review_lexicon

review = review_lexicon(
    (TextUnit("chapter-1", "We met Siobhan.", "en"),),
    include_all_tokens=True,
)
for finding in review.findings:
    print(finding.surface, finding.reasons)

Install ttsready[lexical] to use the optional Lexhint integration with an explicitly constructed provider. See the lexical review guide for findings, offsets, filters, and provider behavior.

Compiler-facing run API

Pipelines that already own token and sentence analysis can use prepare_run() directly:

from ttsready import LinguisticToken, prepare_run

source = "Dr. Smith recorded 2 kg."
run = prepare_run(
    source,
    language="en-US",
    linguistic_tokens=(LinguisticToken(0, 3, text="Dr.", pos="PROPN"),),
    preserve_run_boundaries=True,
)
print(run.spoken_text)
print(run.source_map.map_source_span(0, 3))

Hints are provider-neutral and source-relative to the supplied run; TTSReady never accepts a spaCy/provider object. PreparedRun has no overrides or sentence context. SourceOutputMap preserves exact forward/reverse boundary bias and can be concatenated across runs. See Python API for detailed semantics and the distinction from prepare_text()/prepare_units().

Core contract

  • prepare_run() accepts plain text, explicit language, protected spans, and source-relative LinguisticToken hints without requiring an NLP provider object.

  • prepare_text() and prepare_units() accept immutable TextUnit records; SpeechOverride values express global, unit-scoped, or exact-occurrence pronunciation policy.

  • PreparedRun returns exact SourceOutputMap boundary mappings; review-oriented results add context, QA, fingerprints, and aggregate statistics.

  • Existing result JSON serialization and fingerprints are pure; run maps are in-memory/diagnostic values and persistence remains the caller's responsibility.

  • TextUnit may carry validated provider-neutral linguistic-token hints; prepare_units() and prepare_text() forward them without provider loading. Bulk preparation optionally emits synchronous observation-only progress events and remains silent itself.

  • review_lexicon() exposes provider-neutral lexical review; use the lexical review guide for candidate reasons, filtering, and optional caller-owned evidence providers.

  • split_prepared_text() chunks supplied text at sentence-aware boundaries while preserving exact source slices; see Python API.

from ttsready import TextUnit, prepare_units

result = prepare_units(
    (
        TextUnit("chapter-1", "2 kg", "en-US", role="body"),
        TextUnit("caption-1", "Bonjour.", "fr-FR", role="caption"),
    )
)

for unit in result.units:
    print(unit.unit_id, unit.spoken_text)

Documentation

Migrating from 0.1.x

Version 0.2 introduced a breaking, API-only boundary. SSMD/document APIs, the CLI, file and cache I/O, writers, planning, speaker/JEV workflows, and their application-owned models were removed. Convert or read source data in your application, pass text units to prepare_text() or prepare_units(), then persist or render results in your application. See the migration guide.

License

ttsready is licensed under the Apache License 2.0. See LICENSE for the full text.

Metadata

Release files for ttsready 0.2.4

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

Source distribution (sdist)

Source distribution for ttsready 0.2.4
File Size Uploaded Provenance Actions
ttsready-0.2.4.tar.gz 57.7 kB Without provenance Details for ttsready-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 94.5 kB

Release files / ttsready-0.2.4.tar.gz

Download URL ttsready-0.2.4.tar.gz
Size 57.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c92bfa535990e3a3d1c4aa8404ce334a194fbbd33ddcd6a681b9250eebe783ff
BLAKE2b-256 checksum
How to use checksums
c21247120f4585f253d270575c4886d677de7e68feae5095fc19fe98101e01b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / ttsready-0.2.4-py3-none-any.whl

Download URL ttsready-0.2.4-py3-none-any.whl
Size 36.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c85bb15e9de0c627d9fdaa0ecd44597ad088d5ba4e5318fbf3cf235bf82ac81
BLAKE2b-256 checksum
How to use checksums
307ec40f3d12d8bff753ead44c21711476f34b84dbb050423bb29ff8c9b31bc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Security for ttsready 0.2.4

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