Skip to main content

kitteng2p

Independent phoneme and token-ID frontend targeting the public KittenTTS v0.8 text-cleaner contract.

kitteng2p turns prepared, speakable text into eSpeak phonemes, Kitten-prepared phoneme text, character IDs, and model framing (0, *ids, 10, 0). It does not synthesize audio, load ONNX models, download voices, or perform written-to-spoken semantic normalization. Callers prepare dates, currencies, units, URLs, and abbreviations before phonemization.

The package has a flat layout and uses setuptools-scm for dynamic versioning.

Installation

Install kitteng2p and make a system eSpeak or eSpeak NG runtime available to espeakng-runtime:

python -m pip install kitteng2p

Where supported, install the optional bundled runtime assets instead:

python -m pip install "kitteng2p[bundled]"

The bundled extra provisions eSpeak runtime assets where supported. It does not install KittenTTS, a TTS model, or audio dependencies.

Quick start

from kitteng2p import KittenG2P

with KittenG2P() as g2p:
    result = g2p.phonemize_prepared("Hello, world.")

print(result.phonemes)
print(result.token_ids)
print(result.dropped_symbols)

The result's token_ids already include model framing. The convenience functions phonemes() and phoneme_ids() create and close a temporary frontend.

Command line

kitteng2p "Hello, world."
kitteng2p --language en-gb "Hello, world."
kitteng2p --espeak-mode cli "Hello, world."

The command prints one JSON object with the original text, prepared phonemes, framed token IDs, and any dropped symbols.

Kitten v0.8 compatibility target

kitteng2p reproduces the public KittenTTS v0.8 text-cleaner symbol inventory and model-ID framing:

  • the same pad, punctuation, ASCII-letter, and IPA symbol inventory;
  • duplicate symbols use the last dictionary index, matching upstream construction;
  • symbols outside the inventory are dropped;
  • model IDs are framed as (0, *ids, 10, 0).

This is a codec-level compatibility claim. The released KittenTTS 0.8.1 path uses phonemizer around eSpeak, while kitteng2p uses espeakng-runtime. Exact sentence-level ID parity has not been established across a representative corpus. Do not interpret codec compatibility as end-to-end phonemizer parity. See the compatibility policy.

Documentation

Dynamic versioning

Package versions are derived from Git tags through setuptools-scm. Source archives without Git metadata use the configured 0.1.dev0 fallback. Create a release tag only after the release checklist and artifact gates have passed. At runtime, kitteng2p.__version__ reports the installed distribution version.

Development

python -m pip install -e ".[dev,docs]"
python -m pytest
python -m ruff check kitteng2p tests examples
python -m mypy kitteng2p
python -m compileall -q kitteng2p tests tools examples
python docs/make.py html
python -m build --sdist --wheel

Metadata

Release files for kitteng2p 0.1.1

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

Source distribution (sdist)

Source distribution for kitteng2p 0.1.1
File Size Uploaded
kitteng2p-0.1.1.tar.gz 33.2 kB Details

Built distribution (wheel)

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

Total release size: 48.9 kB

Release files / kitteng2p-0.1.1.tar.gz

Download URL kitteng2p-0.1.1.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
881ef7d587f4b518c79819a90a804bd9bbba79e1fb22278984eb881d0d61a478
BLAKE2b-256 checksum
How to use checksums
330ab422faabb891404bf3c77a7ab8539a753b93df3a904c86cb2843c208ba76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / kitteng2p-0.1.1-py3-none-any.whl

Download URL kitteng2p-0.1.1-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91a62d966c269ec41e795b56db2885dd2b6d20edd65b79dc5f2ac1fcc6d6ff7a
BLAKE2b-256 checksum
How to use checksums
ae014d5646d8d7be4f2db6f574a302a9bedae87109a74cb6e8c9063fdf1d14b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

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