Exemple #1
0
 static function morf($str)
 {
     static $cache = array();
     if ($str[0] === '!') {
         return $str;
     }
     if (isset($cache[$str])) {
         return $cache[$str];
     }
     $res = null;
     if (!hq::$noMorf) {
         $res = MorfFindGroup(hq::Cp1251_To_Utf8($str));
     }
     //echo 'omo_id('.$str.')='.$res.' ';
     static $stemmer = null;
     if ($stemmer === null) {
         $stemmer = new LinguaStemRu();
     }
     $res = $res ? $res : $stemmer->stem_word($str);
     $cache[$str] = $res;
     return $res;
 }
Exemple #2
0
 function stemmer($aArray)
 {
     $Stemmer = new LinguaStemRu();
     $aRet = array();
     foreach ($aArray as $k => $v) {
         $aRet[$k] = $Stemmer->stem_word($v);
     }
     //		Console::log($aRet);
     return $aRet;
 }