How to convert Chinese traditional or simplified characters to Zhuyin phonetic notation?
Example
# simplified
没关系 --> ㄇㄟˊㄍㄨㄢㄒㄧ
# traditional
沒關係 --> ㄇㄟˊㄍㄨㄢㄒㄧ
How to convert Chinese traditional or simplified characters to Zhuyin phonetic notation?
Example
# simplified
没关系 --> ㄇㄟˊㄍㄨㄢㄒㄧ
# traditional
沒關係 --> ㄇㄟˊㄍㄨㄢㄒㄧ
Copyright © 2021 Jogjafile Inc.
With Python
The dragonmapper module does hanzi to zhuyin conversion (internally it converts first to pinyin and then to zhuyin):
With Java
A possible sequence:
Possible scenario for step #1:
Java code
Python code
Scenario for step #2:
Provided that you generated a list of pinyin segments on step #1 you can now break the pinyin into segments and replace them using a map such as this one or this one (in js format).
Alternative approach
Another solution would be mapping Chinese characters directly to zhuyin using any of the available mappings such as this one: https://github.com/osfans/rime-tool/blob/master/data/y/taiwan.dict.yaml. The downside is that (with this particular source) this will only process Simplified Chinese but won't process Traditional characters.