PHP code example of guojikai / pcws

1. Go to this page and download the library: Download guojikai/pcws 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/ */

    

guojikai / pcws example snippets






use Pcws\Pcws;
use Pcws\PcwsException;

try {
	$words_array = Pcws::segment('Hi,Han Meimei!刘德华是会计师嘛?', 2); //String, Length(中文单词起始长度)
} catch (PcwsException $e) {
	echo $e->getMessage();
	exit;
}

var_dump($words_array);

//output:
//string(33) "hi han meimei 刘德华 会计师"