汉语拼音转换工具 go-pinyin

码农软件 · 软件分类 · 拼音转换工具包 · 2019-08-04 11:58:02

软件介绍

汉语拼音转换工具 Go 版。

安装:go get -u github.com/mozillazg/go-pinyin

安装命令行工具: go get -u github.com/mozillazg/go-pinyin/pinyin

$ pinyin 中国人

zhōng guó rén

示例代码:

package main

import (
    "fmt"
    "github.com/mozillazg/go-pinyin"
)

func main() {
    hans := "中国人"
    a := pinyin.NewArgs()
    // 默认输出 [[zhong] [guo] [ren]]
    fmt.Println(pinyin.Pinyin(hans, a))

    // 包含声调 [[zhōng] [guó] [rén]]
    a.Style = pinyin.Tone
    fmt.Println(pinyin.Pinyin(hans, a))

    // 声调用数字表示 [[zho1ng] [guo2] [re2n]]
    a.Style = pinyin.Tone2
    fmt.Println(pinyin.Pinyin(hans, a))

    // 开启多音字模式 [[zhong zhong] [guo] [ren]]
    a = NewArgs()
    a.Heteronym = true
    fmt.Println(pinyin.Pinyin(hans, a))
    // [[zho1ng zho4ng] [guo2] [re2n]]
    a.Style = pinyin.Tone2
    fmt.Println(pinyin.Pinyin(hans, a))
}

本文地址:https://codercto.com/soft/d/11620.html

The Elements of Statistical Learning

The Elements of Statistical Learning

Trevor Hastie、Robert Tibshirani、Jerome Friedman / Springer / 2009-10-1 / GBP 62.99

During the past decade there has been an explosion in computation and information technology. With it have come vast amounts of data in a variety of fields such as medicine, biology, finance, and mark......一起来看看 《The Elements of Statistical Learning》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具