Skip to main content

Lexphon

Lexphon is a generic, lexicon-driven phonemizer and CLI built on G2Lex. It consumes released pronunciation assets and returns normalized IPA without producing Kokoro phonemes.

g2lex-data producer -> G2Lex storage -> Lexphon runtime -> application adapter

The ownership boundary is deliberate:

  • g2lex-data obtains, transforms, validates, licenses, and publishes immutable data releases.
  • G2Lex stores and queries typed lexicon data.
  • Lexphon explicitly installs, verifies, selects, and consumes released assets.
  • KokoroG2P or another application converts generic IPA to its model-specific output.

Lexphon must never contain source acquisition or G2Lex build recipes for production dictionaries.

Package layout

There is intentionally no src/ directory. The import package lives at ./lexphon.

Install for development

python -m pip install -e ".[dev]"
pytest

Data management

Catalog access and downloads are explicit. DataStore.install() is the network-capable provisioning operation. Phonemizer, lookup, token phonemization, rendering, and local store inspection never fetch a catalog or download a lexicon.

lexphon data available de-DE
lexphon data install de-de:gold
lexphon data list
lexphon data info de-de:gold
lexphon data verify de-de:gold
lexphon data remove de-de:gold

Use --catalog PATH_OR_URL and --data-home PATH for a local release or alternate store. Installation downloads the manifest first, verifies manifest and asset hashes and sizes, checks catalog and manifest identity, opens the G2Lex asset, and atomically activates a complete version. Installed metadata is sufficient for offline use and a copied store can be opened without the catalog.

The production German assets are de-de:gold, de-de:crane, de-de:espeak, and de-de:olaph. English CMUdict is available as en-us:cmudict. Membership assets can be installed for inventory use but cannot be selected as pronunciation layers.

Data release versions and the Lexphon Python package version are independent. Pin the data catalog or release during provisioning, and pin the Python dependency separately.

CLI

lexphon -v de-DE "Die Leute kommen."
lexphon -v de-DE --lexicon de-de:crane "Die Leute kommen."
lexphon -v de-DE --lexicon de-de:crane --tag DET "die"
lexphon -v en-US --lexicon en-us:cmudict --json "read"

JSON output contains the rendered IPA plus structured token fields: original text, pronunciation, source category, output alphabet, source encoding, logical lexicon ID, matched key, ordered IPA variants, selector tag, known status, and punctuation status.

Optional standalone fallback is explicit:

lexphon -v de-DE --fallback espeak "unbekannteswort"

Fallback is disabled by default. Unknown tokens remain visible to downstream applications.

Python API

from lexphon import DataStore, Phonemizer

store = DataStore()
with Phonemizer(
    "de-DE",
    lexicons=["de-de:gold"],
    store=store,
    fallback=None,
) as g2p:
    result = g2p.phonemize_tokens("Die Leute")
    for token in result.tokens:
        print(token.text, token.pronunciation, token.source, token.lexicon_id)

phonemize_tokens() is the integration API. It preserves token-level provenance, selectors, variants, punctuation, and unknown words. IPA is normalized to Unicode NFC. ARPABET and CMU-style pronunciations are converted deterministically to IPA. Unsupported alphabets and invalid pronunciation tokens raise stable Lexphon exceptions.

KokoroG2P boundary

KokoroG2P should import Lexphon's Python API, use fallback=None, convert returned IPA using its model-specific vocabulary, and apply its own fallback, stress, ratings, and diagnostics policy. Lexphon does not import KokoroG2P, perform Kokoro validation, or download dictionaries during phonemization.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lexphon-0.1.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lexphon-0.1.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file lexphon-0.1.0.tar.gz.

File metadata

  • Download URL: lexphon-0.1.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for lexphon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ade33f4a18670174dc49d4f60b35df2bcb3f964ebdc145bcbec25168fe22eccb
MD5 495917b1b8f48c37c5f7bd6e8ec26dc8
BLAKE2b-256 688cb60bca81669a43987f649fe24e9dbf1d3b30cdf6eaac88518baf9e8a6398

See more details on using hashes here.

File details

Details for the file lexphon-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lexphon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for lexphon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8665abf30a64c55dc70d772c1a44438b7e2530c7c80e1929b1ed36c327d9f023
MD5 f448c0263cc3f952c7e21a0c7eef9600
BLAKE2b-256 d145fcee8a2886db13a319f32ef01fd27c7c81f05db3e294aebbe029880e55f2

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.3

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 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