ZhuyinPinyin.jl Documentation

The main functionality of this package is supplied via the 2 exported functions: to_zhuyin and to_pinyin, for converting between the zhuyin and pinyin phonetic systems for Mandarin Chinese. Non-zhuyin/non-pinyin characters are preserved in the output, even if they are an incomplete part of what would be a valid zhuyin/pinyin sequence.

For multi-character strings, it is best to have a space (or any non-pinyin/non-zhuyin character) between Chinese characters.

julia> to_zhuyin("bian lian")
"ㄅㄧㄢ ㄌㄧㄢ"

For example, here is an ambiguous case (gives different results with and without a separator).

julia> to_zhuyin("cha nan")
"ㄔㄚ ㄋㄢ"

julia> to_zhuyin("chan an")
"ㄔㄢ ㄢ"

julia> to_zhuyin("chanan")
"ㄔㄢㄢ"

Conversion will greedily match from the left.

API Reference

ZhuyinPinyin.to_zhuyinFunction
to_zhuyin(pinyin)

Convert any pinyin sequences in the source string to its zhuyin equivalent.

Examples

julia> to_zhuyin("lu4 shi1")
"ㄌㄨ4 ㄕ1"

julia> to_zhuyin("shou4 dao4 wei3 qu5")
"ㄕㄡ4 ㄉㄠ4 ㄨㄟ3 ㄑㄩ5"
source
ZhuyinPinyin.to_pinyinFunction
to_pinyin(zhuyin)

Convert any zhuyin sequences in the source string to its pinyin equivalent.

Examples

julia> to_pinyin("ㄨ ㄑㄧ ㄇㄚ ㄏㄟ")
"wu qi ma hei"

julia> to_pinyin("ㄏㄨ2 ㄕㄨㄛ1 ㄅㄚ1 ㄉㄠ4")
"hu2 shuo1 ba1 dao4"
source