{"id":20459753,"url":"https://github.com/rosbit/go-xpinyin","last_synced_at":"2025-07-31T21:03:55.053Z","repository":{"id":189047771,"uuid":"679940120","full_name":"rosbit/go-xpinyin","owner":"rosbit","description":"Translate Chinese hanzi to pinyin (拼音) by Golang, 汉字转拼音","archived":false,"fork":false,"pushed_at":"2023-08-18T03:42:23.000Z","size":131,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T00:24:45.486Z","etag":null,"topics":["chinese-hanzi","golang","hanzi","pinyin"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosbit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-18T01:18:32.000Z","updated_at":"2023-08-18T01:39:29.000Z","dependencies_parsed_at":"2023-08-18T03:37:48.043Z","dependency_job_id":"c449612f-2457-44d5-be82-9cbd77f22cdd","html_url":"https://github.com/rosbit/go-xpinyin","commit_stats":null,"previous_names":["rosbit/go-xpinyin"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-xpinyin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-xpinyin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-xpinyin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-xpinyin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosbit","download_url":"https://codeload.github.com/rosbit/go-xpinyin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242014722,"owners_count":20057880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chinese-hanzi","golang","hanzi","pinyin"],"created_at":"2024-11-15T12:17:11.036Z","updated_at":"2025-03-05T11:17:07.745Z","avatar_url":"https://github.com/rosbit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-xpinyin\n\nTranslate Chinese hanzi to pinyin (拼音) by Golang, 汉字转拼音.\n\nInspired by https://github.com/lxneng/xpinyin\n\n## Usage\n\n```go\npackage main\n\nimport (\n    p \"github.com/rosbit/go-xpinyin\"\n    \"fmt\"\n)\n\nfunc main() {\n    testGetPinyin(\"上海\")\n}\n\nfunc testGetPinyins(s string) {\n    fmt.Printf(\"GetPinyin(\\\"%s\\\")\\n =\u003e %s\\n\", s, p.GetPinyin(s))\n    fmt.Printf(\"GetPinyin(\\\"%s\\\", WithToneMarks())\\n =\u003e %s\\n\", s, p.GetPinyin(s, p.WithToneMarks()))\n    fmt.Printf(\"GetPinyin(\\\"%s\\\", WithToneNumbers())\\n =\u003e %s\\n\", s, p.GetPinyin(s, p.WithToneNumbers()))\n    fmt.Printf(\"GetPinyin(\\\"%s\\\", WithSplitter(\\\"\\\"))\\n =\u003e %s\\n\", s, p.GetPinyin(s, p.WithSplitter(\"\")))\n    fmt.Printf(\"GetPinyin(\\\"%s\\\", WithSplitter(\\\" \\\"))\\n =\u003e %s\\n\", s, p.GetPinyin(s, p.WithSplitter(\" \")))\n}\n```\n\n## More\n\nTo see the detailed usage, run `go test`, the output is:\n\n```\nGetPinyin(\"上海\")\n =\u003e shang-hai\nGetPinyin(\"上海\", WithToneMarks())\n =\u003e shàng-hǎi\nGetPinyin(\"上海\", WithToneNumbers())\n =\u003e shang4-hai3\nGetPinyin(\"上海\", WithSplitter(\"\"))\n =\u003e shanghai\nGetPinyin(\"上海\", WithSplitter(\" \"))\n =\u003e shang hai\nGetInitial('上')\n =\u003e S\nGetInitials(\"上海\")\n =\u003e S-H\nGetInitials(\"上海\", WithSplitter(\"\"))\n =\u003e SH\nGetInitials(\"上海\", WithSplitter(\" \"))\n =\u003e S H\nGetInitials(\"上海\", WithRetroflex())\n =\u003e SH-H\nGetPinyins(\"模型\", WithToneMarks())\n =\u003e [mó-xíng mú-xíng]\nGetPinyins(\"模样\", WithToneMarks())\n =\u003e [mó-yáng mó-yàng mó-xiàng mú-yáng mú-yàng mú-xiàng]\nPASS\nok  \tgithub.com/rosbint/go-xpinyin\t0.570s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosbit%2Fgo-xpinyin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosbit%2Fgo-xpinyin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosbit%2Fgo-xpinyin/lists"}