Skip to content

xuender/go-py

Repository files navigation

go-py

GoCI codecov Go Report Card GoDoc Gitter GitHub license GitHub issues GitHub stars

中文转拼音.

use

go get github.com/xuender/go-py
package main

import (
  "fmt"

  "github.com/xuender/go-py"
  )

func main(){
  fmt.Println(py.Pinyin("阿弥陀佛"))
  fmt.Println(py.Pinyin("阿弥陀佛", py.Tone))
  fmt.Println(py.Pinyin("阿弥陀佛", py.NoTone))
  fmt.Println(py.Pinyin("阿弥陀佛", py.Init))
  fmt.Println(py.Initials("阿弥陀佛"))

  // output:
  // [a1 mi2 tuo2 fu2]
  // [ā mí tuó fú]
  // [a mi tuo fu]
  // [a m t f]
  // amtf
}

cmd

py --help

install

go install github.com/xuender/go-py/cmd/py@latest

examples

py 阿弥陀佛
py -i -s= 阿弥陀佛
py -t -h -hs=\; 阿弥陀佛
py -n 阿弥陀佛