0

次のコマンドを使用して、信頼できる Ubuntu ディストリビューションに pspell をインストールしようとしました。

sudo apt-get install libpspell-dev sudo apt-get install php5-pspell sudo apt-get install aspell-he

インストール プロセス中にエラーが返されなかったため、プロセスは成功したようです。

しかし、実際にこれを試してみると、疑問符 (�) の配列が表示されます。

pspell_config_create("he");
$t = pspell_new('he');

$suggestions = pspell_suggest($t, 'דבל');


return view('master', compact('suggestions')); 
// the above line can be swapped with"
// print_r($suggestions);
// and the result stays the same

ビューを使用した理由は、Web ページに文字セットを設定する必要があるのではないかと考えたため、それを実現するために HTML5 ドキュメント構造を使用しましたが、結果は同じままでした。

私のHTMLマークアップ:

<!doctype html>
<html lang="he">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    סתם טקסט לבדיקה
    <?php print_r($suggestions); ?>
</body>
</html>

それから返された結果:

סתם טקסט לבדיקה Array ( [0] => � [1] => � [2] => � [3] => � [4] => � [5] => � [6] => � )

私がやろうとした別のテストも実行しました:

return pspell_check($t, 'הגדא') ? 'there is' : 'nope';

そして、何らかの理由で、任意の単語に対して「いいえ」で返されました。これは、pspell_check返されたことを意味しますfalse

これを修正する方法はありますか?

編集:

結果の長さを取得しようとすると:

<!doctype html>
<html lang="he">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
@foreach($suggestions as $suggestion)
    {{ strlen($suggestion) }} <br>
@endforeach
</body>
</html>

結果は次のとおりです。

1 
1 
1 
1 
1 
1 
1 

メソッドから返された結果でpspell_suggest、aspell 辞書からデータを取得する際に問題が発生した可能性があります。

4

2 に答える 2

0
于 2015-06-21T16:59:50.533 に答える