コード例 #1
0
ファイル: request.php プロジェクト: mauriciogsc/ATbarPT
 $word = $vars['w'];
 $result = $database->single("SELECT * FROM dictionaryWestern WHERE word = '" . $word . "'");
 if (empty($result) && $lightStem) {
     $queryWord;
     $wordDa = $stemmer->removeDefiniteArticle($word);
     if (empty($result)) {
         $word = $stemmer->normalize($word, true);
         $result = $database->single("SELECT * FROM dictionaryWestern WHERE normalised COLLATE utf8_unicode_ci = '" . $word . "' COLLATE utf8_unicode_ci");
         if (strlen($wordDa) > 6) {
             $result = $database->single("SELECT * FROM dictionaryWestern WHERE normalised like '%" . $wordDa . "%'");
         } else {
             $result = $database->single("SELECT * FROM dictionaryWestern WHERE normalised COLLATE utf8_unicode_ci = '" . $wordDa . "' COLLATE utf8_unicode_ci");
         }
         if (empty($result)) {
             if ($wordDa != $word) {
                 $wordSps = $stemmer->removeSubjectPronounSuffix($wordDa);
                 $queryWord = $wordSps;
             } else {
                 $wordOps = $stemmer->removeObjectPronounSuffix($word);
                 $wordSps = $stemmer->removeSubjectPronounSuffix($wordOps);
                 $wordGp = $stemmer->removeGeneralPrefix($wordSps);
                 $wordVp = $stemmer->removeVerbPrefix($wordGp);
                 $queryWord = $wordVp;
             }
             $result = $database->single("SELECT * FROM dictionaryWestern WHERE normalised COLLATE utf8_unicode_ci = '" . $queryWord . "' COLLATE utf8_unicode_ci");
             if (empty($result) && strlen($queryWord) > 4) {
                 $result = $database->single("SELECT * FROM dictionaryWestern WHERE normalised COLLATE utf8_unicode_ci like '%" . $queryWord . "%' COLLATE utf8_unicode_ci");
             }
         }
     }
 }