{"id":27767,"library":"g2pm","title":"g2pM - Neural Grapheme-to-Phoneme for Mandarin Chinese","description":"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.","status":"maintenance","version":"0.1.2.5","language":"python","source_language":"en","source_url":"https://github.com/kakaobrain/g2pM","tags":["g2p","mandarin","chinese","phoneme","pinyin","bopomofo"],"install":[{"cmd":"pip install g2pm","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from g2pm import G2pM","symbol":"G2pM","correct":"from g2pM import G2pM"}],"quickstart":{"code":"from g2pm import G2pM\n\ng2p = G2pM()\n# Convert pinyin with tone numbers to bopomofo\nresult = g2p('wo3')\nprint(result)  # Output: ㄨㄛˇ\n\n# For a list of pinyin strings\nresults = g2p(['ni3', 'hao3'])\nprint(results)  # Output: ['ㄋㄧˇ', 'ㄏㄠˇ']","lang":"python","description":"Initialize G2pM and convert pinyin to bopomofo."},"warnings":[{"fix":"Preprocess your text to extract pinyin syllables with tone numbers before using g2pM.","message":"Input must be pinyin with tone numbers (e.g., 'ni3'), not Chinese characters or pinyin without tones. The model does not handle characters.","severity":"gotcha","affected_versions":"all"},{"fix":"Run g2p = G2pM() once to trigger download; subsequent calls use cached model.","message":"The package downloads a pre-trained model on first use (~75 MB). Ensure network connectivity or manually cache the model.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using an alternative like pypinyin or jieba for Chinese text processing.","message":"The 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.","severity":"deprecated","affected_versions":"0.1.2.5"}],"env_vars":null,"search_vec":"'0.1.2.5':40 '2021':46 'base':27 'bopomofo':52 'bopomofo/zhuyin':37 'charact':32 'chines':9,22,31,49 'convers':18 'convert':30 'current':38 'g2p':47 'g2pm':1,10 'graphem':4,15 'grapheme-to-phonem':3,14 'infrequ':42 'last':43 'leverag':23 'mandarin':8,21,48 'model':28 'neural':2,13 'packag':19 'phonem':6,17,50 'phonet':35 'pinyin':33,51 'releas':41 'symbol':36 'transform':26 'transformer-bas':25 'updat':44 'version':39","created_at":"2026-05-09T05:51:58.429335+00:00","updated_at":"2026-05-09T05:51:58.429335+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmppct_p820/venv/lib/python3.12/site-packages/g2pM/__init__.py\", line 3, in <module>\n    from .g2pM import G2pM\n  File \"/tmp/tmppct_p820/venv/lib/python3.12/site-packages/g2pM/g2pM.py\", line 3, in <module>\n    imp"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"g2pm","cli_version":"sh: 1: g2pm: not found","type":"library","homepage":null,"github":"https://github.com/kakaobrain/g2pM","docs":null,"changelog":null,"pypi":"https://pypi.org/project/g2pm/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","llm-agents"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}