public static function loadUserDict($f_name, $options = array())
    {
        array_push(self::$user_dictname, $f_name);
        $content = fopen($f_name, "r");
        while (($line = fgets($content)) !== false) {
            $explode_line = explode(" ", trim($line));
            $word = $explode_line[0];
            $freq = isset($explode_line[1]) ? $explode_line[1] : 1;
            $tag = isset($explode_line[2]) ? $explode_line[2] : null;
            $freq = (float) $freq;
            if (isset(self::$original_freq[$word])) {
                self::$total -= self::$original_freq[$word];
            }
            self::$original_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);
        self::__calcFreq();
        self::$dag_cache = array();

        return self::$trie;
    }
public static function loadUserDict($f_name, $options = array())
    {
        array_push(self::$user_dictname, $f_name);
        $content = fopen($f_name, "r");
        while (($line = fgets($content)) !== false) {
            $explode_line = explode(" ", trim($line));
            $word = $explode_line[0];
            $freq = isset($explode_line[1]) ? $explode_line[1] : 1;
            $tag = isset($explode_line[2]) ? $explode_line[2] : null;
            $freq = (float) $freq;
            if (isset(self::$original_freq[$word])) {
                self::$total -= self::$original_freq[$word];
            }
            self::$original_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);
        self::__calcFreq();
        self::$dag_cache = array();

        return self::$trie;
    }
public static function loadUserDict ( $ f_name , $ options = array ( ) ) { array_push ( self :: $ user_dictname , $ f_name ) ; $ content = fopen ( $ f_name , "r" ) ; while ( ( $ line = fgets ( $ content ) ) !== false ) { $ explode_line = explode ( " " , trim ( $ line ) ) ; $ word = $ explode_line [ 0 ] ; $ freq = isset ( $ explode_line [ 1 ] ) ? $ explode_line [ 1 ] : 1 ; $ tag = isset ( $ explode_line [ 2 ] ) ? $ explode_line [ 2 ] : null ; $ freq = ( float ) $ freq ; if ( isset ( self :: $ original_freq [ $ word ] ) ) { self :: $ total -= self :: $ original_freq [ $ word ] ; } self :: $ original_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 ) ; self :: __calcFreq ( ) ; self :: $ dag_cache = array ( ) ; return self :: $ trie ; }
Static method loadUserDict

@param string $f_name  # input f_name
@param array  $options # other options

@return array self::$trie
Static method loadUserDict