/** * 转换最终分词结果到 finallyResult 数组 * @return void */ static private function _sort_finally_result() { $newarr = array(); $i = 0; foreach (self::$simpleResult as $k => $v) { if (empty($v['w'])) continue; if (isset(self::$finallyResult[$k]) && count(self::$finallyResult[$k]) > 0) { foreach (self::$finallyResult[$k] as $w) { if (!empty($w)) { $newarr[$i]['w'] = $w; $newarr[$i]['t'] = 20; $i++; } } } else if ($v['t'] != 21) { $newarr[$i]['w'] = $v['w']; $newarr[$i]['t'] = $v['t']; $i++; } } self::$finallyResult = $newarr; $newarr = ''; }