public static function addWord($word, $freq, $tag = '', $options = array())
    {
        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"=>""));
        self::__calcFreq();
        self::$dag_cache = array();
        return self::$trie;
    }
public static function addWord($word, $freq, $tag = '', $options = array())
    {
        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"=>""));
        self::__calcFreq();
        self::$dag_cache = array();
        return self::$trie;
    }
public static function addWord ( $ word , $ freq , $ tag = '' , $ options = array ( ) ) { 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" => "" ) ) ; self :: __calcFreq ( ) ; self :: $ dag_cache = array ( ) ; return self :: $ trie ; }
Static method addWord

@param string $word
@param float  $freq
@param string $tag

@return array self::$trie
Static method addWord