Constants

NONE

NONE = 'none'

ASCII

ASCII = 'ascii'

UNICODE

UNICODE = 'unicode'

Properties

$punctuations

$punctuations : array

Punctuations map.

Type

array

Methods

__construct()

__construct(string  $loaderName = null) 

Constructor.

Parameters

string $loaderName

convert()

convert(string  $string, string  $option = self::NONE) : array

Convert string to pinyin.

Parameters

string $string
string $option

Returns

array

name()

name(string  $stringName, string  $option = self::NONE) : array

Convert string (person name) to pinyin.

Parameters

string $stringName
string $option

Returns

array

permalink()

permalink(string  $string, string  $delimiter = '-') : string

Return a pinyin permalink from string.

Parameters

string $string
string $delimiter

Returns

string

abbr()

abbr(string  $string, string  $delimiter = '') : string

Return first letters.

Parameters

string $string
string $delimiter

Returns

string

phrase()

phrase(string  $string, string  $delimiter = ' ', string  $option = self::NONE) : string

Chinese phrase to pinyin.

Parameters

string $string
string $delimiter
string $option

Returns

string

sentence()

sentence(string  $sentence, boolean  $withTone = false) : string

Chinese to pinyin sentense.

Parameters

string $sentence
boolean $withTone

Returns

string

splitWords()

splitWords(string  $pinyin, string  $option) : array

Split pinyin string to words.

Parameters

string $pinyin
string $option

Returns

array

prepare()

prepare(string  $string) : string

Preprocess.

Parameters

string $string

Returns

string

romanize()

romanize(string  $string, boolean  $isName = false) : string

Convert Chinese to pinyin.

Parameters

string $string
boolean $isName

Returns

string

convertSurname()

convertSurname(string  $string, \Overtrue\Pinyin\DictLoaderInterface  $dictLoader) : string

Convert Chinese Surname to pinyin.

Parameters

string $string
\Overtrue\Pinyin\DictLoaderInterface $dictLoader

Returns

string

format()

format(string  $pinyin, boolean  $tone = false) : string

Format.

Parameters

string $pinyin
boolean $tone

Returns

string