G2P mix
Project description
g2p-mix
- Cantonese: pycantonese
- English: g2p_en
- Mandarin: pypinyin
Usage
$ pip install g2p-mix
$ python
Mandarin
>>> from g2p_mix import G2pMix
>>> G2pMix().g2p("你这个idea, 不太make sense。", sandhi=True, return_seg=True)
[
{"word": "你", "lang": "ZH", "pos": "r", "phones": [["n", "i3"]]},
{"word": "这个", "lang": "ZH", "pos": "r", "phones": [["zh", "e4"], ["g", "e5"]]},
{"word": "idea", "lang": "EN", "pos": null, "phones": ["AY0", "D", "IY1", "AH0"]},
{"word": ",", "lang": "SYM", "pos": "x", "phones": []},
{"word": "不太", "lang": "ZH", "pos": "d", "phones": [["b", "u2"], ["t", "ai4"]]},
{"word": "make", "lang": "EN", "pos": null, "phones": ["M", "EY1", "K"]},
{"word": "sense", "lang": "EN", "pos": null, "phones": ["S", "EH1", "N", "S"]},
{"word": "。", "lang": "SYM", "pos": "x", "phones": []},
]
Cantonese
>>> G2pMix(jyut=True).g2p("你这个idea, 不太make sense。", return_seg=True)
[
{"word": "你", "lang": "ZH", "pos": "PRON", "phones": [["n", "ei5"]]},
{"word": "這個", "lang": "ZH", "pos": "PRON", "phones": [["z", "e3"], ["g", "o3"]]},
{"word": "idea", "lang": "EN", "pos": null, "phones": ["AY0", "D", "IY1", "AH0"]},
{"word": ",", "lang": "SYM", "pos": "x", "phones": []},
{"word": "不", "lang": "ZH", "pos": "ADV", "phones": [["b", "at1"]]},
{"word": "太", "lang": "ZH", "pos": "ADV", "phones": [["t", "aai3"]]},
{"word": "make", "lang": "EN", "pos": null, "phones": ["M", "EY1", "K"]},
{"word": "sense", "lang": "EN", "pos": null, "phones": ["S", "EH1", "N", "S"]},
{"word": "。", "lang": "SYM", "pos": "x", "phones": []},
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
g2p-mix-0.5.2.tar.gz
(4.9 MB
view details)
File details
Details for the file g2p-mix-0.5.2.tar.gz
.
File metadata
- Download URL: g2p-mix-0.5.2.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc97b6d7a2090ee84f619985860276d5afa6b3d6f041019194c2896b3f690e9b |
|
MD5 | 0809f985fb43c3f44e4d970270998018 |
|
BLAKE2b-256 | b82428ccb7b85c8e25fda5f9df1c9f234ee1fa9c6f7bb25bf6f03a2366151e8c |