I'm trying Enchant spell library.
I have a script that works fine, But I would be able to choose between several dictionaries (Aspell or Myspell)
So as I tried this function enchant_broker_set_dict_path, but it seems to have no effects. And this function is not in the phpdoc, Why ?
Tried on linux, with php 5.3
Here is my script
$words=array('test', 'test');
$suggestions = array();
$enchant = enchant_broker_init();
if (enchant_broker_dict_exists($enchant, $lang)) {
$dict = enchant_broker_request_dict($enchant, $lang);
foreach ($words as $word) {
$correct = enchant_dict_check($dict, $word);
if (!$correct) {
$suggs = enchant_dict_suggest($dict, $word);
if (!is_array($suggs)) {
$suggs = array();
}
$suggestions[$word] = $suggs;
}
}
enchant_broker_free_dict($dict);
enchant_broker_free($enchant);
} else {
enchant_broker_free($enchant);
throw new Exception("Could not find dictionary. Code: " . $lang);
}
Where exactly do you use it in your code?
There was a bug, if you called enchant_broker_get_dict_path before enchant_broker_set_dict_path it wouldn't work.
Also this could help: http://blog.iwanluijks.nl/?!=/post/1-using-enchant-with-php-on-windowspart-1.html
If you use PECL then notice that you need version 1.1.0 or higher since enchant_broker_set_dict_path and enchant_broker_get_dict_path were included in that version.
http://pecl.php.net/package/enchant/1.1.0