Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong pinyin when using Traditional characters #6

Open
gustanas opened this issue Feb 19, 2021 · 4 comments
Open

Wrong pinyin when using Traditional characters #6

gustanas opened this issue Feb 19, 2021 · 4 comments

Comments

@gustanas
Copy link

gustanas commented Feb 19, 2021

Example:

var testTrad = PinyinHelper.getPinyin('乾淨', format: PinyinFormat.WITH_TONE_MARK);
print(testTrad);
var testSimpl = PinyinHelper.getPinyin('干净', format: PinyinFormat.WITH_TONE_MARK);
print(testSimpl);

Output:

qián jìng
gān jìng
@Sky24n
Copy link
Member

Sky24n commented Feb 19, 2021

 List<String> traditionalDict= [ '乾=干'];
ChineseHelper.addChineseDict(traditionalDict);

var testTrad = PinyinHelper.getPinyin('乾淨', format: PinyinFormat.WITH_TONE_MARK);
print(testTrad);

@gustanas
Copy link
Author

Thank you! It works already better!

But how about characters that have multiple pinyin? For example:

List<String> traditionalDict = ['乾=干'];
ChineseHelper.addChineseDict(traditionalDict);

var testTrad = PinyinHelper.getPinyin('乾燥', format: PinyinFormat.WITH_TONE_MARK);
var testTrad2 = PinyinHelper.getPinyin('乾坤', format: PinyinFormat.WITH_TONE_MARK);
print(testTrad);
print(testTrad2);

Output:

gān zào
gān kūn

Shoudn't it be qián kūn instead? https://translate.google.com/?sl=zh-CN&tl=zh-CN&text=%E4%B9%BE%E7%87%A5%0A%E4%B9%BE%E5%9D%A4&op=translate

@Sky24n
Copy link
Member

Sky24n commented Feb 19, 2021

This is a problem, maybe this solution is better.

List<String> multiDict = ['乾净=gān,jìng', '乾燥=gān,zào'];
PinyinHelper.addMultiPinyinDict(multiDict);

var testTrad = PinyinHelper.getPinyin('乾淨', format: PinyinFormat.WITH_TONE_MARK);
print(testTrad);

@gustanas
Copy link
Author

Good suggestion, thank you for your help 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants