本文整理汇总了PHP中SplitWord::isUnpacked方法的典型用法代码示例。如果您正苦于以下问题:PHP SplitWord::isUnpacked方法的具体用法?PHP SplitWord::isUnpacked怎么用?PHP SplitWord::isUnpacked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplitWord
的用法示例。
在下文中一共展示了SplitWord::isUnpacked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: split_word
/**
* 拆分字符串
* @param type $string 要拆分的字符
* @param type $source_charset 输入字符的字符编码
* @param type $target_charset 输出字符的字符编码
* @return array 拆分后的字符以数组形式返回,键名为字符,键值为字符数量
*/
public static function split_word($string, $source_charset = '', $target_charset = 'utf-8', $load_all = TRUE)
{
$charset = C("CHARSET");
$source_charset = empty($source_charset) ? preg_replace("/utf8|utf-8/i", "utf-8", $charset) : $source_charset;
self::$addonDicFile = PATH_ORG . str_replace(PATH_ORG, '', self::$addonDicFile);
self::$mainDicFileZip = PATH_ORG . str_replace(PATH_ORG, '', self::$mainDicFileZip);
self::$mainDicFile = PATH_ORG . str_replace(PATH_ORG, '', self::$mainDicFile);
self::SetSource($string, $source_charset, $target_charset);
self::$isLoadAll = $load_all;
if (file_exists(self::$mainDicFile)) {
self::$isUnpacked = TRUE;
}
if (self::$loadInit) {
self::LoadDict();
}
self::StartAnalysis();
$string = self::GetFinallyIndex();
if (is_array($string)) {
$s = array();
foreach ($string as $k => $v) {
$k = string::remove_punctuation($k);
if (empty($k) || mb_strlen($k, $source_charset) == 1) {
continue;
}
$s[$k] = $v;
}
$string = $s;
}
return $string;
}
示例2: splitWord
/**
* 拆分字符串
* @param type $string 要拆分的字符
* @param type $source_charset 输入字符的字符编码
* @param type $target_charset 输出字符的字符编码
* @return array 拆分后的字符以数组形式返回,键名为字符,键值为字符数量
*/
static public function splitWord($string, $source_charset = '', $target_charset = 'utf-8', $load_all = TRUE) {
self::$splitword_path = HDPHP_EXTEND_PATH.'Org/SplitWord/';
$charset = C("CHARSET");
$source_charset = empty($source_charset) ? preg_replace("/utf8|utf-8/i", "utf-8", $charset) : $source_charset;
self::$addonDicFile = self::$splitword_path . self::$addonDicFile;
self::$mainDicFileZip = self::$splitword_path . self::$mainDicFileZip;
self::$mainDicFile = self::$splitword_path . self::$mainDicFile;
self::SetSource($string, $source_charset, $target_charset);
self::$isLoadAll = $load_all;
if (file_exists(self::$mainDicFile))
self::$isUnpacked = TRUE;
if (self::$loadInit)
self::LoadDict();
self::StartAnalysis();
$string = self::GetFinallyIndex();
if(is_array($string)){
$s = array();
foreach($string as $k=>$v){
$k = string::removePunctuation($k);
// $k = preg_replace("/\w/i",'',$k);
if(empty($k) || mb_strlen($k,$source_charset)==1){
continue;
}
$s[$k]=$v;
}
$string=$s;
}
return $string;
}