G2Lex
G2Lex compiles pronunciation dictionaries into deterministic, mmap-friendly binary lexicons for exact Python lookup. It is designed for G2P, TTS, ASR, forced alignment, and other speech systems that need large read-only dictionaries.
User guide
- Getting started
- Concepts
- Source formats
- G2Lex Binary Lexicon v1
- Python API
- Command-line interface
- Layering
- Package resources
- Compatibility
- Experimental reduction
- Benchmarking
- Changelog
- Current validation status
- Validation record: G2Lex 0.1.0 release candidate
- Environment
- Source revision/tag
- Unit/integration tests
- Coverage
- Ruff/pre-commit
- Compilation and warning-clean tests
- Package build
- Wheel install smoke test
- Sdist install smoke test
- CLI smoke test
- G2Lex v1 exact round trip
- Corruption/integrity tests
- Docs build
- Python-version CI matrix
- Known experimental components
- External source/full benchmark evidence
- Release decision
G2Lex stores exact pronunciations; it does not phonemize unknown words, normalize text, tokenize input, or provide a fallback G2P engine. Use it as the dictionary layer before a consumer-owned fallback.
Quick start
python -m pip install g2lex
g2lex pack lexicon.tsv lexicon.g2lex --format tsv
g2lex verify lexicon.tsv lexicon.g2lex --format tsv
import g2lex
with g2lex.open("lexicon.g2lex") as lexicon:
print(lexicon.get("example"))
G2Lex 0.1.x is an alpha API and format release. The stable G2Lex Binary Lexicon v1 format is intended to remain readable; experimental reduction APIs and assets may change.