Get Pinyin Of Simplified Chinese
In you project root path just run go get github.com/struCoder/Go-pinyin
just run go test
import (
"fmt"
"github.com/struCoder/Go-pinyin"
)
func main() {
str := "**"
py := pinyingo.NewPy(pinyingo.STYLE_TONE) //string with tone -> **: ["zhōng", "guó"]
//py := pinyingo.NewPy(pinyingo.STYLE_NORMAL) //string without tone -> **: ["zhong", "guo"]
//py := pinyingo.NewPy(pinyingo.STYLE_INITIALS) // get initials of string -> **: ["zh", "g"]
fmt.Println(py.Convert(str))
}
- convert han zi to pinyin
- get han zi initial
- deal with heteronym