kokorog2p documentation
kokorog2p is a multilingual grapheme-to-phoneme and Kokoro model adaptation layer. The core accepts prepared, speakable text and an explicit language.
Responsibility boundary
KokoroG2P owns tokenization, phonological normalization, language routing requested by
the caller, annotations, overrides, and phoneme/model output. It does not verbalize
numbers, abbreviations, units, currencies, dates, URLs, or other written semantics.
Applications may prepare those forms with an external tool such as Spokenform before
calling phonemize_prepared().
Quick start
from kokorog2p import phonemize_prepared
result = phonemize_prepared(
"Hello world!", language="en-us", lexicons=()
)
print(result.phonemes)
See Quick Start, prepared phonemization, and the span guide for details.
API Reference
Guides
- Quick Start
- Prepared phonemization
- Language support
- External lexicons and release policy
- Span-Based Phonemization Guide
- Overview
- Core Types
- Exact sub-token language spans
- Automatic language routing
- Structured stress overrides
- Prepared phonemization
- Extended Text Layer
- SSMD and phrasplit compatibility
- Character Offset Coordinate System
- Alignment Modes
- Overlap Handling
- Language Switching
- Phoneme Overrides
- Custom Attributes
- Best Practices
- Common Pitfalls
- See Also
- Advanced Usage
- Prepared text boundary
- Lexphon provider fallback ownership
- Custom G2P Configuration
- Token Inspection
- Dictionary Lookup
- German Lexicon
- Phoneme Utilities
- Vocabulary Encoding
- Quote Handling
- Punctuation Handling
- Word Mismatch Detection
- Semantic preparation
- Custom Backend Selection
- Caching and Performance
- Custom Phoneme Filtering
- Explicit language spans
- Error Handling
- Next Steps
- Selecting named lexicons
- Installation