forked from Elara6331/itd
Fix chinese transliteration when chinese characters are not followed by non-chinese characters
This commit is contained in:
parent
a4598269e5
commit
e70c9f4d7c
@ -39,6 +39,14 @@ func (ct *ChineseTranslit) Transliterate(s string) string {
|
||||
outBuf.WriteRune(char)
|
||||
}
|
||||
}
|
||||
if tmpBuf.Len() > 0 {
|
||||
// Convert to pinyin (without tones)
|
||||
out := pinyin.LazyConvert(tmpBuf.String(), nil)
|
||||
// Write space-separated string to output
|
||||
outBuf.WriteString(strings.Join(out, " "))
|
||||
// Reset temporary buffer
|
||||
tmpBuf.Reset()
|
||||
}
|
||||
// Return output string
|
||||
return outBuf.String()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user