PHP Class Overtrue\Pinyin\Pinyin

Afficher le fichier Open project: overtrue/pinyin Class Usage Examples

Protected Properties

Свойство Type Description
$loader Overtrue\Pinyin\DictLoaderInterface Dict loader.
$punctuations array Punctuations map.

Méthodes publiques

Méthode Description
__construct ( string $loaderName = null ) Constructor.
abbr ( string $string, string $delimiter = '' ) : string Return first letters.
convert ( string $string, string $option = self::NONE ) : array Convert string to pinyin.
getLoader ( ) : Overtrue\Pinyin\DictLoaderInterface Return dict loader,.
name ( string $stringName, string $option = self::NONE ) : array Convert string (person name) to pinyin.
permalink ( string $string, string $delimiter = '-' ) : string Return a pinyin permalink from string.
sentence ( string $sentence, $withTone = false ) : string Chinese to pinyin sentense.
setLoader ( Overtrue\Pinyin\DictLoaderInterface $loader ) Loader setter.
splitWords ( string $pinyin, string $option ) : array Split pinyin string to words.

Méthodes protégées

Méthode Description
convertSurname ( string $string, Overtrue\Pinyin\DictLoaderInterface $dictLoader ) : string Convert Chinese Surname to pinyin.
format ( string $pinyin, boolean $tone = false ) : string Format.
prepare ( string $string ) : string Preprocess.
romanize ( string $string, boolean $isName = false ) : string Convert Chinese to pinyin.

Method Details

__construct() public méthode

Constructor.
public __construct ( string $loaderName = null )
$loaderName string

abbr() public méthode

Return first letters.
public abbr ( string $string, string $delimiter = '' ) : string
$string string
$delimiter string
Résultat string

convert() public méthode

Convert string to pinyin.
public convert ( string $string, string $option = self::NONE ) : array
$string string
$option string
Résultat array

convertSurname() protected méthode

Convert Chinese Surname to pinyin.
protected convertSurname ( string $string, Overtrue\Pinyin\DictLoaderInterface $dictLoader ) : string
$string string
$dictLoader Overtrue\Pinyin\DictLoaderInterface
Résultat string

format() protected méthode

Format.
protected format ( string $pinyin, boolean $tone = false ) : string
$pinyin string
$tone boolean
Résultat string

getLoader() public méthode

Return dict loader,.
public getLoader ( ) : Overtrue\Pinyin\DictLoaderInterface
Résultat Overtrue\Pinyin\DictLoaderInterface

name() public méthode

Convert string (person name) to pinyin.
public name ( string $stringName, string $option = self::NONE ) : array
$stringName string
$option string
Résultat array

prepare() protected méthode

Preprocess.
protected prepare ( string $string ) : string
$string string
Résultat string

romanize() protected méthode

Convert Chinese to pinyin.
protected romanize ( string $string, boolean $isName = false ) : string
$string string
$isName boolean
Résultat string

sentence() public méthode

Chinese to pinyin sentense.
public sentence ( string $sentence, $withTone = false ) : string
$sentence string
Résultat string

setLoader() public méthode

Loader setter.
public setLoader ( Overtrue\Pinyin\DictLoaderInterface $loader )
$loader Overtrue\Pinyin\DictLoaderInterface

splitWords() public méthode

Split pinyin string to words.
public splitWords ( string $pinyin, string $option ) : array
$pinyin string
$option string
Résultat array

Property Details

$loader protected_oe property

Dict loader.
protected DictLoaderInterface,Overtrue\Pinyin $loader
Résultat Overtrue\Pinyin\DictLoaderInterface

$punctuations protected_oe property

Punctuations map.
protected array $punctuations
Résultat array