pinyin

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pinyin provides Chinese to Reader solution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBegin added in v0.0.2

func IsBegin(rtype rune) bool

IsBegin checks if rtype is a begin punctuation.

func IsChar added in v0.0.2

func IsChar(rtype rune) bool

IsChar checks if rtype is Chinese character.

func IsEnd added in v0.0.2

func IsEnd(r rune) bool

IsEnd checks if rtype is a end punctuation.

func IsSurname added in v0.0.2

func IsSurname(rtype rune) bool

IsSurname checks if rtype is surname.

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader represents a pinyin reader.

func FromBytes

func FromBytes(bs []byte) *Reader

FromBytes creates pinyin.Reader from bytes.

func FromFile added in v0.0.2

func FromFile(name string) *Reader

FromFile creates pinyin.Reader from file. For large file, pinyin.FromReader is recommended.

func FromReader

func FromReader(r io.Reader) *Reader

FromReader creates pinyin.Reader from io.Reader.

func FromRunes

func FromRunes(rs []rune) *Reader

FromRunes creates pinyin.Reader from runes.

func FromString

func FromString(s string) *Reader

FromString creates pinyin.Reader from string.

func (*Reader) Converter

func (a *Reader) Converter(o func(string, rune, rune) string) *Reader

Converter sets the Converter option.

func (*Reader) IsName

func (a *Reader) IsName(o bool) *Reader

IsName sets the IsName option.

func (*Reader) NoTone

func (a *Reader) NoTone(o bool) *Reader

NoTone sets the NoTone option.

func (*Reader) Read

func (a *Reader) Read(p []byte) (int, error)

Read reads up to len(p) bytes into p.

func (*Reader) ReadByte

func (a *Reader) ReadByte() (byte, error)

ReadByte reads and returns the next byte from the input or any error encountered.

func (*Reader) ReadRune

func (a *Reader) ReadRune() (rune, int, error)

ReadRune reads a single UTF-8 encoded Unicode character and returns the rune and its size in bytes.

func (*Reader) Separator added in v0.0.2

func (a *Reader) Separator(o string) *Reader

Separator sets the Separator option.

func (*Reader) ToBytes

func (a *Reader) ToBytes() ([]byte, error)

ToBytes outputs to bytes.

func (*Reader) ToFile

func (a *Reader) ToFile(name string) error

ToFile outputs to file.

func (*Reader) ToRunes

func (a *Reader) ToRunes() ([]rune, error)

ToRunes outputs to runes.

func (*Reader) ToString

func (a *Reader) ToString() (string, error)

ToString outputs to string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL