\Overtrue\PinyinGeneratorFileDictLoader

Generator syntax(yield) Dict File loader.

Summary

Methods
Properties
Constants
__construct()
map()
mapSurname()
No public properties found
No constants found
openFile()
getGenerator()
traversing()
$path
$segmentName
$handles
$surnamesHandle
N/A
No private methods found
No private properties found
N/A

Properties

$path

$path : string

Data directory.

Type

string

$segmentName

$segmentName : string

Words segment name.

Type

string

$handles

$handles : array

SplFileObjects.

Type

array

$surnamesHandle

$surnamesHandle : \SplFileObject

surnames.

Type

\SplFileObject

Methods

__construct()

__construct(string  $path) 

Constructor.

Parameters

string $path

map()

map(\Closure  $callback) 

Load dict.

[
    '响应时间' => "[\t]xiǎng[\t]yìng[\t]shí[\t]jiān",
    '长篇连载' => '[\t]cháng[\t]piān[\t]lián[\t]zǎi',
    //...
]

Parameters

\Closure $callback

mapSurname()

mapSurname(\Closure  $callback) 

Load surname dict.

Parameters

\Closure $callback

openFile()

openFile(string  $filename, string  $mode = 'r') : \SplFileObject

Construct a new file object.

Parameters

string $filename

file path

string $mode

file open mode

Returns

\SplFileObject

getGenerator()

getGenerator(array  $handles) : \Generator

get Generator syntax.

Parameters

array $handles

SplFileObjects

Returns

\Generator

traversing()

traversing(\Generator  $generator, \Closure  $callback) 

Traverse the stream.

Parameters

\Generator $generator
\Closure $callback