lmz/phpanalysis

The PHP library for phpanalysis

v1.0.3 2016-10-14 10:02 UTC

This package is auto-updated.

Last update: 2024-12-09 22:31:04 UTC


README

基于phpanalysis的功能封装,方便使用php语言分词

    \Phpanalysis\PhpAnalysis::$loadInit = false;
    $pa = new \Phpanalysis\PhpAnalysis('utf-8', 'utf-8', true);
    //载入词典
    $pa->LoadDict();
    //执行分词
    $pa->SetSource('今天不要忘记给智聪带面膜
    昨天喝了咖啡,晚上失眠,现在蓝瘦香菇
    北京天气变得好冷了,秋风萧瑟');
    $pa->differMax = true;
    $pa->unitWord = true;
    $pa->StartAnalysis( true );
    $okresult = $pa->GetFinallyResult('###', false);

    print_r($okresult);