Registry / ai-ml / g2pm
library0.1.2.5pypypiunverified

g2pM is a neural grapheme-to-phoneme conversion package for Mandarin Chinese, leveraging a transformer-based model to convert Chinese characters (pinyin) to phonetic symbols (bopomofo/zhuyin). Current version 0.1.2.5, released infrequently; last update in 2021.

pip install g2pm
INSTALL
IMPORT
SIG · G2PM
G
g2pm
ai-mlpythonv0.1.2.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

G2pM
from g2pM import G2pM
from g2pm import G2pM

Initialize G2pM and convert pinyin to bopomofo.

from g2pm import G2pM g2p = G2pM() # Convert pinyin with tone numbers to bopomofo result = g2p('wo3') print(result) # Output: ㄨㄛˇ # For a list of pinyin strings results = g2p(['ni3', 'hao3']) print(results) # Output: ['ㄋㄧˇ', 'ㄏㄠˇ']
g2pm --version
Debug
Known issues
gotchaInput must be pinyin with tone numbers (e.g., 'ni3'), not Chinese characters or pinyin without tones. The model does not handle characters.
fix
Preprocess your text to extract pinyin syllables with tone numbers before using g2pM.
affects: all
gotchaThe package downloads a pre-trained model on first use (~75 MB). Ensure network connectivity or manually cache the model.
fix
Run g2p = G2pM() once to trigger download; subsequent calls use cached model.
affects: all
deprecatedThe package has not been updated since 2021 and may not work with newer Python versions (e.g., 3.10+). Known issues with tensorflow or torch dependency mismatches.
fix
Consider using an alternative like pypinyin or jieba for Chinese text processing.
affects: 0.1.2.5
Upgrade
Version history
0.1.2.5latest on PyPI · released Oct 12, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
20
OpenAI (training)
1
Resources
g2pm — pip install g2pm · libregistry