PHP Classes
elePHPant
Icontem

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 (8 years ago) RSS 2.0 feedStarStarStarStar 67%Total: 4,878 This week: 4All time: 535 This week: 202Up
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
Winner


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: 32
All time rank: 30224 in Brazil Brazil
Week rank: 189 Up9 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Details
This class was writen by Felipe Ribeiro <felipernb@gmail.com> using the concepts
of Peter Norvig available at www.norvig.com/spell-correct.html.

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

www.norvig.com/big.txt

then just do:

<?php
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  
 0%
Total:4,878
This week:4
All time:535
This week:202Up
 User Ratings  
 
 All time
Utility:100%StarStarStarStarStarStar
Consistency:95%StarStarStarStarStar
Documentation:79%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:548