Simplified version of gocc and OpenCC.
OpenCC in one executable. You can also use OpenCC in browser. See in-browser Chinese conversion tool.
The config and dictionary Go files are generated from the source of OpenCC version 1.1.9.
You can also generate them using go test
.
go install github.com/caiguanhao/opencc/opencc@latest
package main
import (
"fmt"
"github.com/caiguanhao/opencc"
)
func main() {
// fmt.Println(opencc.Dictionaries)
fmt.Println(opencc.Convert("s2twp", `鼠标里面的硅二极管坏了,导致光标分辨率降低。`))
// 滑鼠裡面的矽二極體壞了,導致游標解析度降低。
}
package main
import (
"fmt"
"github.com/caiguanhao/opencc/configs/tw2sp"
)
func main() {
fmt.Println(tw2sp.Description)
// Traditional Chinese (Taiwan standard) to Simplified Chinese (with phrases)
fmt.Println(tw2sp.Dicts.Convert(`滑鼠裡面的矽二極體壞了,導致游標解析度降低。`))
// 鼠标里面的硅二极管坏了,导致光标分辨率降低。
}