(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )
enchant_dict_suggest — Suggère des orthographes pour un mot
dictionaryUn dictionnaire Enchant retourné par enchant_broker_request_dict() ou enchant_broker_request_pwl_dict().
wordMot à utiliser pour les suggestions
Retourne un tableau de suggestions si le mot est mal orthographié.
Lève une ValueError si
dictionary n'est pas utilisable, par exemple s'il n'a
pas été initialisé ou s'il a déjà été libéré avec
enchant_broker_free_dict().
| Version | Description |
|---|---|
| 8.0.0 |
dictionary attend désormais une instance de EnchantDictionary ;
auparavant, une resource était attendue.
|
Exemple #1 Exemple avec 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 "Suggestions pour 'soong' : ";
print_r($suggs);
}
}
?>