Posts Tagged ‘Spell checker’

PHP Spell Checker v1.1

February 16th, 2010

A new version of PHP Spell Checker is available.
The new feature is checking the spelling with Google’s “Did you mean” feature, so not a big update, but useful non the less.

The syntax is the same:

<?php

// include the class
require_once(dirname(__FILE__)."/../GDYMSpellChecker.class.php");

// instantiate the class
$spellCheck = new GDYMSpellChecker();

$textWithErrors = "PHP: the quik browm fox jumps over the lazi dog lazi today"; // this text has 3 errors
$result = $spellCheck->checkSpelling($textWithErrors, "en-US"); // will return an array with the wrong words with associated suggestions
//$result = $spellCheck->checkSpelling($textWithErrors, "en-US", false); // will return an array with the wrong words without associated suggestions
//print_r($spellCheck->getWarnings());// get all warnings
//print_r($spellCheck->getErrors());// get all errors
if (count($result) == 0) {
	print "Text is OK !<br/>";
} else {
	print "Text has errors !<br/>";
	print "<pre>";
	print_r($result);
}

?>

For further reading about the PHP class [p2p type=”id” value=”20″ text=”read this post”].

Download the class from here

VN:F [1.9.22_1171]
Rating: 7.7/10 (15 votes cast)

PHP Spell Checker

August 18th, 2009

This package can be used to check the spelling of text and get fix suggestions.

There is a base class that defines functions for spell checking.

There are also two classes for checking the spelling of text using either PHP scripts that contain arrays of valid words and grammar definitions, or using the hunspell program.

If the classes determine that there are misspelled words, they may return suggestions for eventual fixes.

» Read more: PHP Spell Checker

VN:F [1.9.22_1171]
Rating: 9.7/10 (12 votes cast)