| Question : | Is it possible to spell check texts from php?
| | Answer : | Yes as most other things spell checking is also possible from php, to do so you need to compile / activate the pspell/aspell lib. For an example of using the pspell lib from php read this article from zend http://www.zend.com/zend/spotlight/spellchecking.php
Although the pspell/aspell lib's need installing on the server only --with-pspell needs to be added to the PHP configuration.
The following code seems to work :-
<?
// /home/username/dict/ Must be world read/write
//
$pspell_link = pspell_new_personal ("/home/username/dict/custom.pws", "en", "", "", "",PSPELL_FAST|PSPELL_RUN_TOGETHER);
$word = "spelllng";
echo "The word '$word' was not spelled correctly<P>";
echo "Possible correct spellings are: <BR>";
$suggestions = pspell_suggest ($pspell_link, $word);
for ($i=0; $i < count ($suggestions); $i++)
{
echo "Possible spelling: " . $suggestions[$i] . "<br>";
}
echo "<BR>";
?>
| | |