Installation method of SCWS participle extension under unix/linux

Source: Internet
Author: User

<?php

/**
* 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 (' Baidu Security '));

?>

SCWS Download: http://www.xunsearch.com/scws/download.php

PSCWS4 Download: http://download.csdn.net/detail/pzp_118/5412639

Installation method of SCWS participle extension under unix/linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.