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    
Last Updated Ratings Unique User Downloads Download Rankings
2008-10-07 (9 years ago) RSS 2.0 feedStarStarStarStar 67%Total: 5,195 This week: 3All time: 487 This week: 209Up
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
Name: Felipe Ribeiro is available for providing paid consulting. Contact Felipe Ribeiro .
Classes: 2 packages by
Country: Brazil Brazil
Age: 33
All time rank: 29123 in Brazil Brazil
Week rank: 178 Up5 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:3
All time:487
This week:209Up
 User Ratings  
 All time