Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

go-pinyin

> 编程语言
Open source

汉字转拼音

1.8K stars0 likes1 views
WebsiteGitHub

About

汉字转拼音

go-pinyin

汉语拼音转换工具 Go 版。

Installation

go get github.com/mozillazg/go-pinyin

install CLI tool:

# go version>=1.17
go install github.com/mozillazg/go-pinyin/cli/pinyin@latest

# go version<1.17
go get -u github.com/mozillazg/go-pinyin/cli/pinyin

$ pinyin 中国人
zhōng guó rén

Documentation

API documentation can be found here: https://godoc.org/github.com/mozillazg/go-pinyin

Usage

…

注意:

  • 默认情况下会忽略没有拼音的字符(可以通过自定义 Fallback 参数的值来自定义如何处理没有拼音的字符, 详见 示例)。
  • 根据 《汉语拼音方案》 y,w,ü (yu) 都不是声母, 以及不是所有拼音都有声母,如果这不是你预期的话,你可能需要的是首字母风格 FirstLetter ( 详细信息 )。

Related Projects

  • hotoo/pinyin: 汉语拼音转换工具 Node.js/JavaScript 版。
  • mozillazg/python-pinyin: 汉语拼音转换工具 Python 版。
  • mozillazg/rust-pinyin: 汉语拼音转换工具 Rust 版。

pinyin data

  • 使用 pinyin-data 的拼音数据

License

Under the MIT License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gochinesegogolanghanzi

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言