CakeFest 2024: The Official CakePHP Conference

enchant_dict_suggest

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )

enchant_dict_suggest修正候補となる値の一覧を返す

説明

enchant_dict_suggest(EnchantDictionary $dictionary, string $word): array

パラメータ

dictionary

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

word

修正候補を調べる単語。

戻り値

単語のスペルが間違っている場合に、修正候補の配列を返します。

変更履歴

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

例1 enchant_dict_suggest() の例

<?php
$tag
= 'en_US';
$r = enchant_broker_init();
if (
enchant_broker_dict_exists($r,$tag)) {
$d = enchant_broker_request_dict($r, $tag);

$wordcorrect = enchant_dict_check($d, "soong");
if (!
$wordcorrect) {
$suggs = enchant_dict_suggest($d, "soong");
echo
"'soong' の修正候補:";
print_r($suggs);
}
enchant_broker_free_dict($d);
}
enchant_broker_free($r);
?>

参考

add a note

User Contributed Notes

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