oro-g2p 🗣️
oro-g2p is a zero-dependency, research-grade Yoruba Grapheme-to-Phoneme (G2P) engine and phonetic tokenizer designed for speech synthesis (TTS), automatic speech recognition (ASR), and forced alignment.
It provides out-of-the-box native token mapping for Kokoro-82M and StyleTTS2.
Key Features
- Deterministic Linguistic Engine: Pure, rule-based Yoruba phonology — zero hallucinations, reproducible output.
- Post-Nasal Harmony: Automatically captures unwritten phonetic nasalization on vowels following nasal consonants
mandn(ọmọ →/ɔˉmɔ̃ˉ/, inú →/iˉnũˊ/). - Chameleon Syllabic Nasals: Dynamically applies homorganic place assimilation to
ńandǹ:- Labials (
b,f):/m/(Mo ń bọ̀ →moˉ mˊ bɔˋ) - Alveolars (
d,t,s,ṣ):/n/(Mo ń ṣe →moˉ nˊ ʃeˉ) - Velars & Glides (
l,k,g):/ŋ/(Mo ń lọ →moˉ ŋˊ lɔˉ)
- Labials (
- Typo Resilience: Seamlessly normalizes Turkish cedillas (
ş), combining vertical lines (\u0329), and out-of-order diacritic keystrokes into canonical Yoruba underdots (ẹ,ọ,ṣ). - Contour Glides: Expands carons (
ǎ→àáLow-High) and circumflexes (â→áàHigh-Low). - Native Kokoro Alignment: Maps 100% of Yoruba phonemes and tones directly into Kokoro-82M's 178-token embedding table with 0 missing tokens.
Installation
pip install oro-g2p
Quickstart
1. Basic G2P Conversion
from oro_g2p import g2p
# Converts Yoruba text to tone-marked IPA
phonemes = g2p("Ẹ kú àárọ̀, ọmọ Yorùbá!")
print(phonemes)
# Output: 'ɛˉ kuˊ aˋaˊɾɔˋ, ɔˉmɔ̃ˉ joˉɾuˋbaˊ!'
2. Kokoro-82M Tokenization
from oro_g2p import yoruba_to_kokoro
text = "Ẹ kú àárọ̀"
ipa_str, token_ids, missing = yoruba_to_kokoro(text)
print(f"IPA: {ipa_str}")
print(f"Token IDs: {token_ids}")
print(f"Missing: {missing}") # [] -> 100% coverage!
Architecture: Kokoro-82M Token Mapping
Kokoro has a fixed embedding matrix size of 178 (0 to 177). While 114 slots were occupied by Western languages, 64 slots were unassigned.
oro-g2p resolves Yoruba without modifying any pre-trained weights or embedding tensor dimensions:
- High Tone (Mí): Assigned to Vacant Slot
7(ˊ) - Mid Tone (Ré): Assigned to Vacant Slot
8(ˉ) - Low Tone (Dò): Assigned to Vacant Slot
26(ˋ) - Nasal Vowels: Decomposed into
(vowel + \u0303), cleanly utilizing Kokoro's native Room17.
Running Tests
python -m pytest tests/
License
MIT License. Free for academic, personal, and commercial speech technology research.
Metadata
Release files for oro-g2p 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oro_g2p-0.1.0.tar.gz | 10.7 kB | Without provenance | Details for oro_g2p-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oro_g2p-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for oro_g2p-0.1.0-py3-none-any.whl |
Total release size: 20.6 kB
Release files / oro_g2p-0.1.0.tar.gz
| Download URL | oro_g2p-0.1.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
598feb27af2a62a4a5c5a28e9f6d574d2e0d9dca9afc9a3c52318e2aa406552b
|
|
BLAKE2b-256 checksum How to use checksums |
80c1f517e0fff340b277e836d77a23f5d2780a3304c8c45de32be0c4fab737d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / oro_g2p-0.1.0-py3-none-any.whl
| Download URL | oro_g2p-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
710c5dcedc13fa7f45c769acef727ab175a644a1da41b6ddce043ec147fd2b12
|
|
BLAKE2b-256 checksum How to use checksums |
7700ac9f64d97a53ade2a73807d17ab47383401e83f23474a288d1d56579daab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for oro-g2p 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.