...

View Full Version : How to use PHP pspell_config_repl



devils19
12-24-2010, 09:16 PM
I am attempting to do a spell-checker that does the google "is this what you meant" thing. I have this function that I enter a word and I want it to use the replace suggestions from "/dict/replace.txt" but it only gives me suggestions from PHP's built-in dictionary.

What am I doing wrong so that the pspell_config_repl feature isn't working with the pspell_suggest function?

I am using the following code:



spellCheck("tee");

function spellCheck($word) {
$p_cfg = pspell_config_create("en");
pspell_config_personal($p_cfg, "/dict/dictionary.txt");
pspell_config_repl($p_cfg, "/dict/replace.txt");
$p_link = pspell_new_config($p_cfg);

$su = pspell_suggest($p_link, $word);
if ($su) {
// Return first suggested word
return $su[1];
} else {
// Return word
return $word;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum