public static function genTrie($f_name, $options = array())
{
$defaults = array('mode' => 'default');
$options = array_merge($defaults, $options);
self::$trie = new MultiArray(file_get_contents($f_name . '.json'));
self::$trie->cache = new MultiArray(file_get_contents($f_name . '.cache.json'));
$content = fopen($f_name, "r");
while (($line = fgets($content)) !== false) {
$explode_line = explode(" ", trim($line));
$word = $explode_line[0];
$freq = $explode_line[1];
$tag = $explode_line[2];
$freq = (double) $freq;
self::$FREQ[$word] = $freq;
self::$total += $freq;
//$l = mb_strlen($word, 'UTF-8');
//$word_c = array();
//for ($i=0; $i<$l; $i++) {
// $c = mb_substr($word, $i, 1, 'UTF-8');
// array_push($word_c, $c);
//}
//$word_c_key = implode('.', $word_c);
//self::$trie->set($word_c_key, array("end"=>""));
}
fclose($content);
return self::$trie;
}