Skip to content

Commit

Permalink
Merge pull request #1 from hitochan777-misc/fix-light-tone-behavior
Browse files Browse the repository at this point in the history
Fix HanziToPinyin conversion of r with light tone
  • Loading branch information
jcramb authored Apr 1, 2021
2 parents 9afd51d + b68e243 commit 1130567
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cedict.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ func min(x, y, z int) int {
return z
}

var vowels = "AaEeiOouü"
var vowels = "AaEeiOouür"

var toneNums = "12345"

Expand All @@ -739,6 +739,7 @@ var mapNumToTone = map[rune][]rune{
'o': []rune("ōóǒòo"),
'u': []rune("ūúǔùu"),
'ü': []rune("ǖǘǚǜü"),
'r': []rune("rrrrr"),
}

var mapToneToNum = map[rune]string{
Expand Down
1 change: 1 addition & 0 deletions cedict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func TestHanziToPinyin(t *testing.T) {
tests := map[string]string{
"": "",
" ": "",
"画儿": "Huà r",
"人民银行旁边一行人abc字母【路牌】,平行宇宙发行股票。": "Rén mín yín háng páng biān yī xíng rén abc zì mǔ [lù pái], píng xíng yǔ zhòu fā xíng gǔ piào.",
"我的大王!": "Wǒ de dà wáng!",
//"你好。我饿了。": "Nǐ hǎo. Wǒ èle.",
Expand Down

0 comments on commit 1130567

Please sign in to comment.