2

pspellの問題を教えてください。aspell をインストールし、ターミナルで次のコマンドを実行しました。

sudo apt-get install libpspell-dev 
sudo apt-get install php7.0-pspell
sudo apt-get install aspell-en

私のOSはlinux Mint 17.PHP - 7.0.28です。function-checker を使用しようとすると、空の配列が返されます。しかし、私はそれがホスティングで正しく機能することを明確に知っています. 関数のコード:

function fixMistakeInQString($string, $lang){
    $pspell_config = pspell_config_create($lang);
    pspell_config_mode($pspell_config, PSPELL_FAST);
    $pspell_link = pspell_new_config($pspell_config);


    if (!pspell_check($pspell_link, $string)) {
        $result = pspell_suggest($pspell_link, $string);
        foreach ($result as $key => $value){
            if(preg_match('~\s~ui', $value) || preg_match('~-~ui', $value)){
                unset($result[$key]);
            }
        }
        return $result;
    }else{
        return array($string);
    }
}
4

0 に答える 0