1、修改源文件结构支持composer
2、把切分同时优化的操作模式改为独立步骤操作(即是粗分、切分、优化三步完全独立)
3、修改类成员调用支持自身引用,即是 xx()->xx()->xx() 模式
use Tutu\PhpAnalysis;
header('content-type:text/html;charset=utf-8');
$result_str = PhpAnalysis::Instance()
->SetSource("composer的出现真是让人们眼前一亮,web开发从此变成了一件很『好玩』的事情。")
->Delimiter(' ')
->ExecSimpleAnalysis()
->ExecDeepAnalysis()
->Optimize( true );
echo $result_str;
如果用默认参数,上面也可以简化为:
$result_str = PhpAnalysis::Instance()
->SetSource("composer的出现真是让人们眼前一亮,web开发从此变成了一件很『好玩』的事情。")
->Exec();
- Instance( $force_init = false )
- SetOptions($unit_special_word=true, $unit_single_word=false, $max_split=false, $high_freq_priority=false, $optimize=true)
- SetSource($source, $source_encoding = 'utf-8', $target_encoding='utf-8')
- LoadDict( $main_dic_file = '' )
- AssistBuildDict( $source_file, $target_file='' )
- AssistExportDict( $target_file, $dicfile = '' )
- AssistGetSimple( $string=true )
- GetNewWords( $is_array=false )
- GetTags( $num = 10, $with_rank = false )