Skip to main content

epitone

G2P libraries for extracting IPA transcriptions with Chao tone marks from orthographic representations.

All output is in Unicode NFD (Normalized Form Decomposed), ensuring consistent handling of combining characters like tone diacritics, nasalization markers, and tie bars.

Installation

pip install epitone

Usage

Thai

from epitone import ThaiG2P

g2p = ThaiG2P()

# Convert Thai text to IPA
ipa = g2p.transliterate("สวัสดี")
print(ipa)  # sow˩˥ʔat˩diː˧

# Get tokenized output
tokens = g2p.transliterate_tokenized("กา")
print(tokens)  # ['k', 'aː', '˧']

# Disable tones
g2p_no_tone = ThaiG2P(include_tones=False)
print(g2p_no_tone.transliterate("กา"))  # kaː

Vietnamese

Three dialect varieties are supported:

  • HanoiG2P - Northern Vietnamese (Hanoi)
  • NgheAnG2P - Central Vietnamese (Nghệ An)
  • SaiGonG2P - Southern Vietnamese (Sài Gòn/Ho Chi Minh City)
from epitone import HanoiG2P, NgheAnG2P, SaiGonG2P

# Northern (Hanoi) dialect
hanoi = HanoiG2P()
print(hanoi.transliterate("xin chào"))  # sin˧ tɕaːw˨˩

# Central (Nghệ An) dialect
nghe_an = NgheAnG2P()
print(nghe_an.transliterate("xin chào"))  # sin˧ tɕaːw˧˩

# Southern (Sài Gòn) dialect
saigon = SaiGonG2P()
print(saigon.transliterate("xin chào"))  # sin˧ tɕaːw˨˩

# Dialect comparison - 'd' onset differs
print(hanoi.transliterate("da"))   # zaː˧ (d→z in North)
print(saigon.transliterate("da"))  # jaː˧ (d→j in South)

# Disable tones
hanoi_no_tone = HanoiG2P(include_tones=False)
print(hanoi_no_tone.transliterate("má"))  # maː

Key Dialect Differences

Feature Hanoi (North) Nghệ An (Central) Sài Gòn (South)
d, gi /z/ /z/ /j/
r /z/ /ʐ/ (retroflex) /ɹ/ (approximant)
s /s/ /ʂ/ (retroflex) /ʂ/ (retroflex)
tr /tɕ/ (=ch) /ʈ/ (retroflex) /tɕ/ (=ch)
v /v/ /v/ /j/
hỏi tone ˧˩˧ (distinct) ˧˩˨ (merged with ngã) ˨˩˦ (merged with ngã)
ngã tone ˧ˀ˥ (distinct) ˧˩˨ (merged with hỏi) ˨˩˦ (merged with hỏi)

Yoruba

from epitone import YorubaG2P

g2p = YorubaG2P()

# Convert Yoruba text to IPA
print(g2p.transliterate("bàbá"))   # ba˨ba˦ (father - low + high tone)
print(g2p.transliterate("ọmọ"))    # ɔ˧mɔ˧ (child)

# Labial-velar consonants use tie bars
print(g2p.transliterate("pupa"))   # k͡pu˧k͡pa˧ (red - 'p' is /k͡p/)
print(g2p.transliterate("gbogbo")) # ɡ͡bo˧ɡ͡bo˧ (all - 'gb' digraph)

# Affricates use tie bars
print(g2p.transliterate("ẹja"))    # ɛ˧d͡ʒa˧ (fish - 'j' is /d͡ʒ/)

# Syllabic nasals with syllabicity marker
print(g2p.transliterate("ń lọ"))   # n̩˦ lɔ˧ (I am going)

# Nasal vowels
print(g2p.transliterate("san"))    # sã˧ (run)

# Get tokenized output
tokens = g2p.transliterate_tokenized("bá")
print(tokens)  # ['b', 'a', '˦']

# Disable tones
g2p_no_tone = YorubaG2P(include_tones=False)
print(g2p_no_tone.transliterate("bàbá"))  # baba

Hmong

Three Hmong converters are available:

  • HmongDawG2P - White Hmong (RPA orthography)
  • MongLengG2P - Green/Blue Hmong (RPA orthography)
  • DananshanG2P - Dananshan Miao (Pinyin-based orthography)
from epitone import HmongDawG2P, MongLengG2P, DananshanG2P

# White Hmong (Hmong Daw)
hmong_daw = HmongDawG2P()
print(hmong_daw.transliterate("kuv"))   # ku˨˦  (I/me)
print(hmong_daw.transliterate("peb"))   # pe˥   (-b = high tone)
print(hmong_daw.transliterate("hlub"))  # l̥u˥   (voiceless lateral)

# Green/Blue Hmong (Mong Leng) - different tone values
mong_leng = MongLengG2P()
print(mong_leng.transliterate("peb"))   # pe˥˧  (-b = high falling in Mong Leng)

# Nasal vowels (ee, oo, aa)
print(hmong_daw.transliterate("neeb"))  # nẽ˥   (nasalized /e/)
print(hmong_daw.transliterate("kaab"))  # kã˥   (nasalized /a/)

# Breathy voice on -g tone (marked on vowel)
print(hmong_daw.transliterate("pog"))   # pɔ̤˨   (breathy /ɔ/)

# Consonant clusters use standard IPA (no superscripts)
print(hmong_daw.transliterate("plab"))  # pla˥  (/pl/, not /pˡ/)
print(hmong_daw.transliterate("ntawv")) # ntaɨ˨˦ (/nt/, not /ⁿt/)

# Dananshan Miao (numeric tones 1-8)
dananshan = DananshanG2P()
print(dananshan.transliterate("ba1"))   # pa˦˦  (tone 1)
print(dananshan.transliterate("ma3"))   # ma˦˧  (tone 3)

# Get tokenized output
tokens = hmong_daw.transliterate_tokenized("kuv")
print(tokens)  # ['k', 'u', '˨˦']

# Disable tones
hmong_no_tone = HmongDawG2P(include_tones=False)
print(hmong_no_tone.transliterate("kuv"))  # ku

Hmong RPA Tone Letters

Letter Hmong Daw Mong Leng Description
-b ˥ (55) ˥˧ (53) High
-j ˥˨ (52) ˥˨ (52) High falling
-v ˨˦ (24) ˨˦ (24) Mid rising
-s ˨˩ (21) ˨˩ (21) Low
-g ˨ (22) ˧ (33) Breathy (+ breathy voice on vowel)
-m ˩ (11) ˩ (11) Low falling
-d ˩˧ (13) ˩˧ (13) Low rising
(none) ˧ (33) ˧˥ (35) Mid / Mid rising

Burmese

from epitone import BurmeseG2P

g2p = BurmeseG2P()

# Basic syllables
print(g2p.transliterate("က"))      # ka˨˩ (simple syllable, low tone)
print(g2p.transliterate("ခ"))      # kʰa˨˩ (aspirated)
print(g2p.transliterate("ကား"))    # ka˥˩ (with visarga - high tone)

# Medial consonants
print(g2p.transliterate("ကျ"))     # kja˨˩ (ya-pin medial)
print(g2p.transliterate("ကွ"))     # kwa˨˩ (wa-hswe medial)
print(g2p.transliterate("မှ"))     # mʰa˨˩ (ha-hto aspiration)

# Vowels
print(g2p.transliterate("ကေ"))     # ke˨˩ (e vowel)
print(g2p.transliterate("ကိ"))     # ki˨˩ (i vowel)
print(g2p.transliterate("ကု"))     # ku˨˩ (u vowel)

# Creaky tone with anusvara
print(g2p.transliterate("ကံ"))     # kã̰˧ (creaky phonation marked)

# Checked syllables (stop coda)
print(g2p.transliterate("ကပ်"))    # kaʔ˥ (checked tone)

# Myanmar country name
print(g2p.transliterate("မြန်မာ"))  # mjan˨˩ma˨˩

# Get tokenized output
tokens = g2p.transliterate_tokenized("က")
print(tokens)  # ['k', 'a', '˨˩']

# Disable tones
g2p_no_tone = BurmeseG2P(include_tones=False)
print(g2p_no_tone.transliterate("ကား"))  # ka

# Disable phonation markers
g2p_no_phon = BurmeseG2P(include_phonation=False)
print(g2p_no_phon.transliterate("ကံ"))  # kã˧ (no creaky mark)

Burmese Tones

Tone Context Chao Letter
Low Open syllables ˨˩
High With visarga း ˥˩
Creaky With anusvara ံ ˧ (+ creaky voice ̰)
Checked Stop coda ˥

Tone Representation

Tones are represented using Chao tone letters (IPA convention):

Thai Tones

Tone Chao Letter
Mid ˧
Low ˩
Falling ˥˩
High ˦˥
Rising ˩˥

Vietnamese Tones (Hanoi)

Tone Vietnamese Name Chao Letter
Level ngang ˧
Falling huyền ˨˩
Rising sắc ˧˥
Dipping hỏi ˧˩˧
Creaky rising ngã ˧ˀ˥
Heavy nặng ˧ˀ˩

Yoruba Tones

Tone Mark Chao Letter
High á (acute) ˦
Mid a (unmarked) ˧
Low à (grave) ˨

Yoruba Special Features

  • Labial-velar consonants: 'p' → /k͡p/, 'gb' → /ɡ͡b/ (with tie bar ͡)
  • Affricate: 'j' → /d͡ʒ/ (with tie bar ͡)
  • Syllabic nasals: m̩, n̩ with syllabicity marker (̩)
  • Nasal vowels: Vn → Ṽ (ã, ɛ̃, ĩ, ɔ̃, ũ)
  • Open-mid vowels: ẹ → /ɛ/, ọ → /ɔ/

Unicode Normalization

All G2P modules output strings in Unicode NFD (Normalized Form Decomposed). This means:

  • Composite characters are split into base + combining characters
  • ã (precomposed) becomes a + ̃ (combining tilde)
  • Tie bars like ͡ are combining characters following the first character

For comparison with NFD output, use the provided utilities:

from epitone import to_nfd, to_nfc, nfd_equal

# Convert to NFD for comparison
result = g2p.transliterate("san")
assert to_nfd("ã") in result  # Compare using NFD form

# Or use nfd_equal for direct comparison
assert nfd_equal(result, expected_output)

Supported Languages

  • Thai - Full support for Thai orthography to IPA conversion with tone marks
  • Vietnamese - Three dialect varieties (Hanoi, Nghệ An, Sài Gòn)
  • Yoruba - Full support with labial-velars, syllabic nasals, and 3-tone system
  • Hmong - RPA (White Hmong, Green Hmong) and Dananshan orthographies
  • Burmese - Myanmar script with 4-tone system, medials, and phonation

Planned

  • Lao
  • Mixtec varieties
  • Additional West African languages

License

MIT

Metadata

Release files for epitone 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epitone 0.1.0
File Size Uploaded Provenance Actions
epitone-0.1.0.tar.gz 55.3 kB Without provenance Details for epitone-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for epitone 0.1.0
File Interpreter ABI Platform Actions
epitone-0.1.0-py3-none-any.whl Python 3 none any Details for epitone-0.1.0-py3-none-any.whl

Total release size: 106.0 kB

Release files / epitone-0.1.0.tar.gz

Download URL epitone-0.1.0.tar.gz
Size 55.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c013a17a886b1b534711340822ae718eec5c32a5b95282e824c196b34f669d35
BLAKE2b-256 checksum
How to use checksums
80fb485e95dab72c95cf013c01b6332c6cacef18e4182232ee4df365c892fb62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / epitone-0.1.0-py3-none-any.whl

Download URL epitone-0.1.0-py3-none-any.whl
Size 50.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
371f5633855664173b4349cf2495318827a6883769645b25a49d1c1ea656b965
BLAKE2b-256 checksum
How to use checksums
6e816f8e9e9d084dcb4a9b371347356abb6197a49c6471c4a53858d1b4d1b906
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for epitone 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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