Jump to content

PSpell


The Little Guy

Recommended Posts

Say what?

 

<pre><?php

$res = pspell_new('en');

$words = array('Hello', 'hello', 'HELLO');

foreach( $words as $word ) {
if( pspell_check($res, $word) )
	echo "$word is spelled correctly\n";
else
	echo "$word is spelled incorrectly\n";
}

?></pre>

 

Outputs

 

Hello is spelled correctly
hello is spelled correctly
HELLO is spelled correctly

Link to comment
https://forums.phpfreaks.com/topic/129699-pspell/#findComment-673170
Share on other sites

Well, technically a proper noun starts with a capital letter... so it is spelled incorrectly.

 

This little hack should work though...

 

<pre><?php

$res = pspell_new('en');

$words = array('ryan', 'taylor', 'bob', 'shoe');

foreach( $words as $word ) {
   if( pspell_check($res, ucfirst($word)) )
      echo "$word is spelled correctly\n";
   else
      echo "$word is spelled incorrectly\n";
}

?></pre>

Link to comment
https://forums.phpfreaks.com/topic/129699-pspell/#findComment-673715
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.