\Overtrue\PinyinPinyin

Class Pinyin.

Summary

Methods
Properties
Constants
__construct()
convert()
name()
permalink()
abbr()
phrase()
sentence()
setLoader()
getLoader()
hasOption()
No public properties found
No constants found
romanize()
convertSurname()
splitWords()
prepare()
formatTone()
$loader
$punctuations
N/A
No private methods found
No private properties found
N/A

Properties

$punctuations

$punctuations : array

Punctuations map.

Type

array

Methods

__construct()

__construct(string  $loaderName = null) 

Constructor.

Parameters

string $loaderName

convert()

convert(string  $string, integer  $option = PINYIN_DEFAULT) : array

Convert string to pinyin.

Parameters

string $string
integer $option

Returns

array

name()

name(string  $stringName, integer  $option = PINYIN_NAME) : array

Convert string (person name) to pinyin.

Parameters

string $stringName
integer $option

Returns

array

permalink()

permalink(string  $string, string  $delimiter = '-', integer  $option = PINYIN_DEFAULT) : string

Return a pinyin permalink from string.

Parameters

string $string
string $delimiter
integer $option

Returns

string

abbr()

abbr(string  $string, string  $delimiter = '', integer  $option = PINYIN_DEFAULT) : string

Return first letters.

Parameters

string $string
string $delimiter
integer $option

Returns

string

phrase()

phrase(string  $string, string  $delimiter = ' ', integer  $option = PINYIN_DEFAULT) : string

Chinese phrase to pinyin.

Parameters

string $string
string $delimiter
integer $option

Returns

string

sentence()

sentence(string  $string, string  $delimiter = ' ', integer  $option = \PINYIN_NO_TONE) : string

Chinese to pinyin sentence.

Parameters

string $string
string $delimiter
integer $option

Returns

string

hasOption()

hasOption(integer  $option, integer  $check) : boolean

Parameters

integer $option
integer $check

Returns

boolean

romanize()

romanize(string  $string, integer  $option = \PINYIN_DEFAULT) : string

Convert Chinese to pinyin.

Parameters

string $string
integer $option

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

splitWords()

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

Split pinyin string to words.

Parameters

string $pinyin
string $option

Returns

array

prepare()

prepare(string  $string, integer  $option = \PINYIN_DEFAULT) : string

Pre-process.

Parameters

string $string
integer $option

Returns

string

formatTone()

formatTone(string  $pinyin, integer  $option = \PINYIN_NO_TONE) : string

Format.

Parameters

string $pinyin
integer $option

Returns

string