Getting number of misspelled word in paragraph in php

103 Views Asked by At

I have a textarea in a form and the submitted form will give the result of number of mispelled word in a paragraph.As because i am using linux, i have tried to install the pspell for PHP 5

And i have installed this package

sudo apt-get install libpspell-dev sudo apt-get install php5-pspell sudo apt-get install aspell-en

but it doesnot work

And this is my code

<?php if(isset($_POST['submit'])){
$text=$_POST['text'];
$mispell_count = 0;
$words = explode(" ", $text);
$pspell_link = pspell_new("en");
foreach ($words as $texts) {
if (!pspell_check($pspell_link, $texts)) {
    $mispell_count++;
}
} 
$msgSpellCheck = "Misspelled words in text " . $mispell_count;    
?>        
<form name="formdata" id="formdata" action="" method="post">
<textarea name="text" id="text"></textarea>
<input type="submit" name="submit" id="submit" value="submit">
</form> 

any opinion will be fine and if any other alternative solution

it gives me the fatal error Fatal error:

Call to undefined function pspell_new()

0

There are 0 best solutions below