- /**
- * Chinese word processing method
- *+---------------------------------
- * @param stirng $string The string to be processed
- * @param boolers $sort =false The reverse according to value
- * @param Numbers $top = 0 Returns the specified number, returning all by default
- *+---------------------------------
- * @return void
- */
- function Scws ($text, $top = 5, $return _array = false, $sep = ', ') {
- Include ('./pscws4/pscws4.php ');//go to the URL below to download the PSCWS4
- $CWS = new Pscws4 (' Utf-8 ');
- $CWS-Set_charset (' utf-8 ');
- $CWS-Set_dict ('./pscws4/etc/dict.utf8.xdb ');
- $CWS-Set_rule ('./pscws4/etc/rules.utf8.ini ');
- $CWS->set_multi (3);
- $CWS-Set_ignore (true);
- $cws->set_debug (TRUE);
- $cws->set_duality (TRUE);
- $CWS-Send_text ($text);
- $ret = $cws-Get_tops ($top, ' r,v,p ');
- $result = null;
- foreach ($ret as $value) {
- if (false = = = $return _array) {
- $result. = $sep. $value [' word '];
- } else {
- $result [] = $value [' word '];
- }
- }
- return false = = = $return _array? SUBSTR ($result, 1): $result;
- }
- Print_r (Scws (' Blue and white kui dragon pattern Incense burner ');
http://www.bkjia.com/PHPjc/735068.html www.bkjia.com true http://www.bkjia.com/PHPjc/735068.html techarticle PHP/** * Chinese word processing method *+---------------------------------* @paramstirng $string the string to be processed * @paramboolers $sort = False reverse based on value * @paramNumbers $top ...