PHP code example of kjcy8 / phpanalysis

1. Go to this page and download the library: Download kjcy8/phpanalysis library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kjcy8 / phpanalysis example snippets


use phpanalysis\PhpAnalysis;

PhpAnalysis::$loadInit = false;
$pa = new PhpAnalysis('utf-8', 'utf-8', true);

//载入词典
$pa->LoadDict();

//执行分词
$pa->SetSource('在西安国际港站,8台龙门吊正在同时吊装来自世界各地的集装箱。');
$pa->differMax = true;
$pa->unitWord = true;
$pa->StartAnalysis(true);

$okresult = $pa->GetFinallyResult(',', false);

print_r($okresult);