(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant:0.2.0-1.0.1)
enchant_dict_quick_check — Vérifie si le mot est correctement orthographié et fournit des suggestions
$dictionary, string $word, array &$suggestions = null): bool
Retourne true si le mot est correctement orthographié, false si la variable des suggestions est fournie,
et la remplit des suggestions possibles.
dictionaryUn dictionnaire Enchant retourné par enchant_broker_request_dict() ou enchant_broker_request_pwl_dict().
wordLe mot à vérifier
suggestionsSi le mot n'est pas correctement orthographié, cette variable contiendra un tableau de suggestions.
| Version | Description |
|---|---|
| 8.0.0 |
dictionary attend désormais une instance de EnchantDictionary ;
auparavant, une resource était attendu.
|
Exemple #1 Exemple avec 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);
}
?>Résultat de l'exemple ci-dessus est similaire à :
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
)