Here's an example of how to use pspell when you don't want or you can't use the dictionaries installed on the system.
<?
$text_to_check = 'I can sspeak English';
$clean_text_to_check = preg_replace('/[^a-z0-9\-\.!;]+/i', ' ', $text_to_check);
$word_list = preg_split('/\s+/', $clean_text_to_check);
$pspell_config = pspell_config_create("en", null, null, 'utf-8');
pspell_config_data_dir($pspell_config, "/home/alex/dictionaries/");
pspell_config_dict_dir($pspell_config, "/home/alex/dictionaries/");
$pspell_link = pspell_new_config($pspell_config);
foreach($word_list as $word) {
if (!pspell_check($pspell_link, trim($word))) {
$suggestions = pspell_suggest($pspell_link, trim($word));
echo $word . ' misspelled <br />';
foreach ($suggestions as $suggestion) {
echo "\t Possible spelling: $suggestion <br />";
}
}
else {
}
}
?>