Linguistically motivated grapheme-to-IPA and allophone mappings for thousands of languages, dialects and historical stages
Actively maintained. Last release 1 day ago, commits in 18 of the last 26 weeks. A safe choice.
pip install orthography2ipaREADME as published on PyPI with version 7.123.9.
orthography2ipa
orthography2ipa (o2i) turns the spelling of a language into the
International Phonetic Alphabet
(IPA), and it measures how languages relate to each other. Each language is a
cited JSON spec in orthography2ipa/data/. A shared engine with no
language-specific code turns the specs into transcriptions and into ranked
pronunciation lattices. The library ships no trained weights and no word
lists.
The registry holds thousands of language codes: major standard languages,
regional dialects, creoles and reconstructed proto-languages. Run
orthography2ipa list for the live list. Most of these codes are stubs. The
language explorer shows each spec,
its tier and its sources.
[!WARNING] Check the quality tier and the benchmark row of a language before you depend on it. Most specs are
stuborskeleton, and few areproduction. PER is poor for several major languages, English among them. Most gold sets are semi-automatic, so read a PER as a direction, not a precise value. The limits are listed in docs/index.md.
Install
uv pip install --prerelease=allow orthography2ipa
The project installs with uv. CONTRIBUTING.md sets up a clone of the repository for development.
The runtime extras are hf, lexicons, validation and portuguese, for
example 'orthography2ipa[lexicons]'. An extra adds a feature, and its
install changes no transcription.
docs/guide/getting_started.md lists
what each extra adds.
Quick start
import orthography2ipa
orthography2ipa.transcribe("olá mundo", "pt") # 'ɔˈla ˈmũdu'