PHP Classes

Spell Corrector: Suggest corrected spelling text in pure PHP

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 62%Total: 7,182 All time: 268 This week: 49Up
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
Picture of Felipe Ribeiro
Name: Felipe Ribeiro is available for providing paid consulting. Contact Felipe Ribeiro .
Classes: 2 packages by
Country: Brazil Brazil
Age: 39
All time rank: 22112 in Brazil Brazil
Week rank: 164 Up12 in Brazil Brazil Equal
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 (2)  
File Role Description
Accessible without login Plain text file README Doc. README file
Plain text file SpellCorrector.php Class The class itself

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:7,182
This week:0
All time:268
This week:49Up
 User Ratings  
 
 All time
Utility:92%StarStarStarStarStar
Consistency:89%StarStarStarStarStar
Documentation:75%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:62%StarStarStarStar
Rank:874