PHP Classes

Spell Corrector: Suggest corrected spelling text in pure PHP

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 6,737 This week: 33All time: 301 This week: 6Up
Version License PHP version Categories
spellcorrector 0.1BSD License5.0Algorithms, PHP 5, Text processing
Description Author

This class can be used to suggest the correct spelling of text similar to Google "Did you mean" but based on a pure PHP implementation of Peter Norvig correct spelling suggestion algorithm.

It takes a given word and returns a suggestion of the probable correct spelling of the word.

The class can build a dictionary with correctly spelled words from a training text document. The dictionary can be stored in a cache file by serializing the dictionary array.

A sample training text document can be obtained from Peter Norvig site.

Innovation Award
PHP Programming Innovation award winner
October 2008

Prize: One copy of the Zend Studio
Google provides spelling suggestions to search keywords that seem misspelled.

There is already a PHP class that uses that Google search feature to suggest corrections to given text strings that may be misspelled.

This class provides a a similar solution to Google "Did you mean" to suggest the correct spelling of words. It uses pure PHP code and does not require accessing remote site.

Manuel Lemos
Picture of Felipe Ribeiro
Name: Felipe Ribeiro is available for providing paid consulting. Contact Felipe Ribeiro .
Classes: 2 packages by
Country: Brazil Brazil
Age: 36
All time rank: 23515 in Brazil Brazil
Week rank: 5 Up1 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

This class was writen by Felipe Ribeiro <> using the concepts
of Peter Norvig available at

To use this class, you should first download a sample text to be used as dictionary at:

then just do:

include 'SpellCorrector.php';

echo SpellCorrector::correct('octabr');
//it will output *october*
  Files folder image Files  
File Role Description
Accessible without login Plain text file README Doc. README file
Plain text file SpellCorrector.php Class The class itself

 Version Control Unique User Downloads Download Rankings  
This week:33
All time:301
This week:6Up
For more information send a message to info at phpclasses dot org.