Source for file EnchantSpell.php
Documentation is available at EnchantSpell.php
* $Id: EnchantSpell.php,v 1.1 2009/08/07 01:59:36 sam2kb Exp $
* This class was contributed by Michel Weimerskirch.
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
* Spellchecks an array of words.
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
* @param Array $words Array of words to check.
* @return Array of misspelled words.
$r =
enchant_broker_init();
if (enchant_broker_dict_exists($r,$lang)) {
$d =
enchant_broker_request_dict($r, $lang);
foreach($words as $key =>
$value) {
$correct =
enchant_dict_check($d, $value);
$returnData[] =
trim($value);
enchant_broker_free_dict($d);
* Returns suggestions for a specific word.
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
* @param String $word Specific word to get suggestions for.
* @return Array of suggestions for the specified word.
$r =
enchant_broker_init();
if (enchant_broker_dict_exists($r,$lang)) {
$d =
enchant_broker_request_dict($r, $lang);
$suggs =
enchant_dict_suggest($d, $word);
enchant_broker_free_dict($d);