CakeFest 2024: The Official CakePHP Conference

enchant_dict_quick_check

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant:0.2.0-1.0.1)

enchant_dict_quick_check単語のスペルが正しいかどうかを調べ、修正候補を提供する

説明

enchant_dict_quick_check(EnchantDictionary $dictionary, string $word, array &$suggestions = null): bool

単語のスペルが正しい場合は true、そうでない場合は false を返します。変数 suggestions を指定している場合は、 そこに修正候補が格納されます。

パラメータ

dictionary

enchant_broker_request_dict() または enchant_broker_request_pwl_dict() によって返される Enchant 辞書。

word

調べる単語。

suggestions

単語のスペルが間違っている場合に、 この変数の中に修正候補の配列が格納されます。

戻り値

単語のスペルが正しい場合に true、 そうでない場合に false を返します。

変更履歴

バージョン 説明
8.0.0 dictionary は、EnchantDictionary クラスのインスタンスを期待するようになりました。 これより前のバージョンでは、リソース が期待されていました。

例1 enchant_dict_quick_check() の例

<?php
$tag
= 'en_US';
$r = enchant_broker_init();

if (
enchant_broker_dict_exists($r,$tag)) {
$d = enchant_broker_request_dict($r, $tag);
enchant_dict_quick_check($d, 'soong', $suggs);
print_r($suggs);
}
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [0] => song
    [1] => snog
    [2] => soon
    [3] => Sang
    [4] => Sung
    [5] => sang
    [6] => sung
    [7] => sponge
    [8] => spongy
    [9] => snag
    [10] => snug
    [11] => sonic
    [12] => sing
    [13] => songs
    [14] => Son
    [15] => Sonja
    [16] => Synge
    [17] => son
    [18] => Sejong
    [19] => sarong
    [20] => sooner
    [21] => Sony
    [22] => sown
    [23] => scone
    [24] => song's
)

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top