Properties

$mask_value

$mask_value : 

Type

$sourceCharSet

$sourceCharSet : 

Type

$targetCharSet

$targetCharSet : 

Type

$resultType

$resultType : 

Type

$notSplitLen

$notSplitLen : 

Type

$toLower

$toLower : 

Type

$differMax

$differMax : 

Type

$unitWord

$unitWord : 

Type

$loadInit

$loadInit : 

Type

$differFreq

$differFreq : 

Type

$addonDic

$addonDic : 

Type

$addonDicFile

$addonDicFile : 

Type

$dicStr

$dicStr : 

Type

$mainDic

$mainDic : 

Type

$mainDicHand

$mainDicHand : 

Type

$mainDicInfos

$mainDicInfos : 

Type

$mainDicFile

$mainDicFile : 

Type

$isLoadDic

$isLoadDic : 

Type

$newWords

$newWords : 

Type

$foundWordStr

$foundWordStr : 

Type

$loadTime

$loadTime : 

Type

$sourceString

$sourceString : 

Type

$isLoadAll

$isLoadAll : 

Type

$dicWordMax

$dicWordMax : 

Type

$simpleResult

$simpleResult : 

Type

$finallyResult

$finallyResult : 

Type

Methods

__construct()

__construct(  $source_charset = 'utf-8',   $target_charset = 'utf-8',   $load_all = true,   $source = '') : void

构造函数

Parameters

$source_charset
$target_charset
$load_all
$source

__destruct()

__destruct() 

析构函数

GetWordInfos()

GetWordInfos(  $key,   $type = 'word') : \short

从文件获得词

Parameters

$key
$type

(类型 word 或 key_groups)

Returns

\short —

int

SetSource()

SetSource(  $source,   $source_charset = 'utf-8',   $target_charset = 'utf-8') : boolean

设置源字符串

Parameters

$source
$source_charset
$target_charset

Returns

boolean

SetResultType()

SetResultType(  $rstype) : void

设置结果类型(只在获取finallyResult才有效)

Parameters

$rstype

1 为全部, 2去除特殊符号

LoadDict()

LoadDict(  $maindic = '') : void

载入词典

Parameters

$maindic

IsWord()

IsWord(  $word) 

检测某个词是否存在

Parameters

$word

GetWordProperty()

GetWordProperty(  $word) : void

获得某个词的词性及词频信息

Parameters

$word

SetWordInfos()

SetWordInfos(  $word,   $infos) : \void;

指定某词的词性信息(通常是新词)

Parameters

$word
$infos

Returns

\void;

StartAnalysis()

StartAnalysis(  $optimize = true) : boolean

开始执行分析

Parameters

$optimize

Returns

boolean

GetFinallyResult()

GetFinallyResult(  $spword = ' ',   $word_meanings = false) : string

获取最终结果字符串(用空格分开后的分词结果)

Parameters

$spword
$word_meanings

Returns

string

GetSimpleResult()

GetSimpleResult() : \array()

获取粗分结果,不包含粗分属性

Returns

\array()

GetSimpleResultAll()

GetSimpleResultAll() : \array()

获取粗分结果,包含粗分属性(1中文词句、2 ANSI词汇(包括全角),3 ANSI标点符号(包括全角),4数字(包括全角),5 中文标点或无法识别字符)

Returns

\array()

GetFinallyIndex()

GetFinallyIndex() : \array('word'=>count,...)

获取索引hash数组

Returns

\array('word'=>count,...)

GetFinallyKeywords()

GetFinallyKeywords(  $num = 10) : string

获取最终关键字(返回用 "," 间隔的关键字)

Parameters

$num

Returns

string

MakeDict()

MakeDict(  $source_file,   $target_file = '') : void

编译词典

Parameters

$source_file
$target_file

ExportDict()

ExportDict(  $targetfile) : void

导出词典的词条

Parameters

$targetfile

_get_index()

_get_index(  $key) : \short

根据字符串计算key索引

Parameters

$key

Returns

\short —

int

_deep_analysis()

_deep_analysis(  $str,   $ctype,   $spos,   $optimize = true) : boolean

深入分词

Parameters

$str
$ctype
$spos
$optimize

Returns

boolean

_deep_analysis_cn()

_deep_analysis_cn(  $str,   $lastec,   $spos,   $slen,   $optimize = true) : void

中文的深入分词

Parameters

$str
$lastec
$spos
$slen
$optimize

_optimize_result()

_optimize_result(  $smarr,   $spos) 

Parameters

$smarr
$spos

_sort_finally_result()

_sort_finally_result() : void

转换最终分词结果到 finallyResult 数组

_out_string_encoding()

_out_string_encoding(  $str) 

把uncode字符串转换为输出字符串

Parameters

$str

_source_result_charset()

_source_result_charset() : integer

获得保存目标编码

Returns

integer