Skip to main content

inflectg2p

An Inflect v2 phoneme and token-ID frontend for prepared, speakable English text.

inflectg2p sends text through espeakng-runtime, applies the Inflect symbol inventory, and intersperses VITS-style blank IDs. It does not expand numbers, dates, times, currency, abbreviations, identifiers, or other semantic written forms. Prepare those in your application before calling this package. It does not load a TTS model or synthesize audio.

Install

python -m pip install inflectg2p

Optional runtime and lexicon extras:

python -m pip install 'inflectg2p[bundled]'
python -m pip install 'inflectg2p[lexphon]'
python -m pip install 'inflectg2p[g2lex]'

Lexicon packages and pronunciation assets are optional. inflectg2p never downloads lexicons implicitly. See installation and lexicons.

Python

from inflectg2p import InflectG2P

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

print(result.phonemes)
print(result.token_ids)
print(result.token_count)

result.text is the unchanged input. result.lexicon_hits reports explicit lexicon matches when configured. The functional helpers phonemize_prepared, phonemes, and phoneme_ids are also available.

CLI

inflectg2p 'Hello, world.'
inflectg2p --espeak-mode cli 'Hello, world.'
inflectg2p --lexicon en-us:lexhint 'Saskatchewan is fluorescent.'

The CLI prints JSON containing the prepared text, phonemes, token IDs, and token count. There is no --normalize option because semantic preparation belongs to the caller.

Documentation and examples

Start with the documentation index. Runnable examples are in examples/.

Compatibility

The exact contract covers the Inflect v2 symbol inventory, strict symbol validation, and blank framing. eSpeak pronunciation depends on the installed runtime and voice data. See compatibility for the boundaries and golden snapshots.

Version and license

Versions are derived from Git tags with setuptools-scm. The project is licensed under Apache-2.0; see LICENSE and NOTICE.

Metadata

Release files for inflectg2p 0.1.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 inflectg2p 0.1.0
File Size Uploaded
inflectg2p-0.1.0.tar.gz 43.5 kB Details

Built distribution (wheel)

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

Total release size: 67.9 kB

Release files / inflectg2p-0.1.0.tar.gz

Download URL inflectg2p-0.1.0.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a8521084b5a4ef98f1f97db6faadc0dedcef2738bdedf701a77a1f60b460f6e4
BLAKE2b-256 checksum
How to use checksums
aca57ee167b4f898129c44e8d0b782d4442a5928ebbb02e6f726196f95b22ed2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / inflectg2p-0.1.0-py3-none-any.whl

Download URL inflectg2p-0.1.0-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f819b7e58ec4e57d223bc7c8963a0a41d3371e68828b1742224065d986a0d01b
BLAKE2b-256 checksum
How to use checksums
ebede9844bc4b0b8547c60ea9a1cb9b209815f8fd165b64e2e438a9168732f49
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.0 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