本文整理汇总了PHP中SplitWord::mainDicFileZip方法的典型用法代码示例。如果您正苦于以下问题:PHP SplitWord::mainDicFileZip方法的具体用法?PHP SplitWord::mainDicFileZip怎么用?PHP SplitWord::mainDicFileZip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplitWord
的用法示例。
在下文中一共展示了SplitWord::mainDicFileZip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoadDict
/**
* 载入词典
*
* @return void
*/
static function LoadDict($maindic = '') {
self::$addonDicFile = self::$addonDicFile;
self::$mainDicFile = self::$mainDicFile;
self::$mainDicFileZip = self::$mainDicFileZip;
$startt = microtime(TRUE);
//正常读取文件
$dicAddon = self::$addonDicFile;
if ($maindic == '' || !file_exists($maindic)) {
$dicWords = self::$mainDicFile;
} else {
$dicWords = $maindic;
self::$mainDicFile = $maindic;
}
//加载主词典(只打开)
if (self::$isUnpacked) {
self::$mainDicHand = fopen($dicWords, 'r');
} else {
self::$InportDict(self::$mainDicFileZip);
}
//载入副词典
$hw = '';
$ds = file($dicAddon);
foreach ($ds as $d) {
$d = trim($d);
if ($d == '')
continue;
$estr = substr($d, 1, 1);
if ($estr == ':') {
$hw = substr($d, 0, 1);
} else {
$spstr = _SP_;
$spstr = iconv(UCS2, 'utf-8', $spstr);
$ws = explode(',', $d);
$wall = iconv('utf-8', UCS2, join($spstr, $ws));
$ws = explode(_SP_, $wall);
foreach ($ws as $estr) {
self::$addonDic[$hw][$estr] = strlen($estr);
}
}
}
self::$loadTime = microtime(TRUE) - $startt;
self::$isLoadDic = TRUE;
}