(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant:0.2.0-1.0.1)
enchant_dict_quick_check — 检查单词是否拼写正确并提供建议
$dictionary
, string $word
, array &$suggestions
= null
): bool如果单词拼写正确,则返回 true
,否则返回 false
,如果提供了 suggestions 变量,则用拼写替代项填充它。
dictionary
由 enchant_broker_request_dict() 或 enchant_broker_request_pwl_dict() 返回的 Enchant 词典。
word
要检查的单词
suggestions
如果单词拼写不正确,此变量将包含建议数组。
版本 | 描述 |
---|---|
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 )