-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
// Package pinyin : 汉语拼音转换工具 | ||
// | ||
// Usage | ||
// | ||
// package main | ||
// | ||
// import ( | ||
// "fmt" | ||
// "github.com/mozillazg/go-pinyin" | ||
// ) | ||
// | ||
// func main() { | ||
// hans := "中国人" | ||
// // 默认 | ||
// a := pinyin.NewArgs() | ||
// fmt.Println(pinyin.Pinyin(hans, a)) | ||
// // [[zhong] [guo] [ren]] | ||
// | ||
// // 包含声调 | ||
// a.Style = pinyin.Tone | ||
// fmt.Println(pinyin.Pinyin(hans, a)) | ||
// // [[zhōng] [guó] [rén]] | ||
// | ||
// // 声调用数字表示 | ||
// a.Style = pinyin.Tone2 | ||
// fmt.Println(pinyin.Pinyin(hans, a)) | ||
// // [[zho1ng] [guo2] [re2n]] | ||
// | ||
// // 开启多音字模式 | ||
// a = pinyin.NewArgs() | ||
// a.Heteronym = true | ||
// fmt.Println(pinyin.Pinyin(hans, a)) | ||
// // [[zhong zhong] [guo] [ren]] | ||
// a.Style = pinyin.Tone2 | ||
// fmt.Println(pinyin.Pinyin(hans, a)) | ||
// // [[zho1ng zho4ng] [guo2] [re2n]] | ||
// } | ||
// | ||
/* | ||
Package pinyin : 汉语拼音转换工具. | ||
Usage | ||
package main | ||
import ( | ||
"fmt" | ||
"github.com/mozillazg/go-pinyin" | ||
) | ||
func main() { | ||
hans := "中国人" | ||
// 默认 | ||
a := pinyin.NewArgs() | ||
fmt.Println(pinyin.Pinyin(hans, a)) | ||
// [[zhong] [guo] [ren]] | ||
// 包含声调 | ||
a.Style = pinyin.Tone | ||
fmt.Println(pinyin.Pinyin(hans, a)) | ||
// [[zhōng] [guó] [rén]] | ||
// 声调用数字表示 | ||
a.Style = pinyin.Tone2 | ||
fmt.Println(pinyin.Pinyin(hans, a)) | ||
// [[zho1ng] [guo2] [re2n]] | ||
// 开启多音字模式 | ||
a = pinyin.NewArgs() | ||
a.Heteronym = true | ||
fmt.Println(pinyin.Pinyin(hans, a)) | ||
// [[zhong zhong] [guo] [ren]] | ||
a.Style = pinyin.Tone2 | ||
fmt.Println(pinyin.Pinyin(hans, a)) | ||
// [[zho1ng zho4ng] [guo2] [re2n]] | ||
} | ||
*/ | ||
package pinyin |