tangs b030ce89ca openbilibili | hace 5 años | |
---|---|---|
.. | ||
BUILD | hace 5 años | |
README.md | hace 5 años | |
constant.go | hace 5 años | |
dict.go | hace 5 años | |
opencc.go | hace 5 años | |
opencc_test.go | hace 5 años |
opencc is a golang port of OpenCC(Open Chinese Convert 開放中文轉換) which is a project for conversion between Traditional and Simplified Chinese developed by BYVoid.
opencc stands for "Golang version OpenCC", it is a total rewrite version of OpenCC in Go. It just borrows the dict files and config files of OpenCC, so it may not produce the same output with the original OpenCC.
package main
import (
"fmt"
"log"
"context"
"go-common/library/text/translate/chinese"
)
func main() {
chinese.Init()
in := `请不要怀疑,这是一个由人工智能推荐的频道。`
out, err := chinese.Convert(context.Background(),in)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s:%s\n", in, out)
}
// 请不要怀疑,这是一个由人工智能推荐的频道。
// 請不要懷疑,這是一個由人工智慧推薦的頻道。
s2t
Simplified Chinese to Traditional Chineset2s
Traditional Chinese to Simplified Chineses2tw
Simplified Chinese to Traditional Chinese (Taiwan Standard)tw2s
Traditional Chinese (Taiwan Standard) to Simplified Chineses2hk
Simplified Chinese to Traditional Chinese (Hong Kong Standard)hk2s
Traditional Chinese (Hong Kong Standard) to Simplified Chineses2twp
Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiomtw2sp
Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese idiomt2tw
Traditional Chinese (OpenCC Standard) to Taiwan Standardt2hk
Traditional Chinese (OpenCC Standard) to Hong Kong Standard