Grapheme-to-phoneme conversion for Ghanaian languages: 42 languages, IPA and native-orthography output, built on africa-g2p
# ghana-g2p
Grapheme-to-phoneme conversion for **Ghanaian languages**, built on
africa-g2p.
africa-g2p covers 400+ African languages from a single general registry. `ghana-g2p`
narrows that to the languages actually spoken in Ghana and fixes what breaks when you
run real Ghanaian text through it: missing rule sets, Unicode codepoint variants, and
a handful of incorrect or incomplete mappings.
```python
from ghana_g2p import GhanaG2P
tw = GhanaG2P("Asante Twi")
tw.ipa("Mfiase no Onyankopɔn bɔɔ ɔsoro.") # 'mfiasenooɲankʰopʰɔnbɔɔɔsoɾo'
tw.grapheme("Mfiase no Onyankopɔn bɔɔ ɔsoro.") # 'mfiasenoonyankopɔnbɔɔɔsoro'
tw.ipa("Akwaaba", sep=" ") # 'a kʷ a a b a'
```
## Install
```bash
pip install ghana-g2p
```
That pulls africa-g2p, whose rule tables this builds on.
Nothing else is needed — both are pure Python with no other runtime dependencies.
For development:
```bash
git clone
github.com
cd ghana-g2p
pip install -e .
```
## Why this exists
Running the full ghana-speech
corpus through africa-g2p surfaced three classes of problem. Each is fixed here, and every
fix is recorded as data you can inspect rather than hidden in code.
**1. Ten Ghanaian languages have no rules at all.** Birifor, Buli, Konni, Lelemi, Ntrubo,
Sehwi, Sekpele, Selee, Tampulma and Tuwuli are simply absent. Each is mapped to a related
language chosen by linguistic classification first, then measured orthographic coverage —
never by character overlap alone, which ranks a Mande language above Dagaare for Birifor
purely because they share the Latin alphabet.
**2. Codepoint variants.** Ghanaian orthographies write the same vowel with different
Unicode characters. Birifor and Tem spell /ʊ/ as `ʊ` (U+028A); the matching rule sets use
`ʋ` (U+028B). Tumulung Sisaala writes `ɩ ʋ` where the `ssl` rules expect `ɪ ʊ`. Normalising
these lifts Tem from 0.97 to full coverage and Sisaala from 0.80 to 1.00.
**3. Incomplete and incorrect rule sets.** …