Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A spelling correction tool for ruby
branch: master


Spellingbee is a ruby gem that gives you spelling suggestions based on the words present in a source file that acts as the dictionary. The alternate spelling suggestions are based on the frequency with which the words occur in the source file.


Install the gem by using gem install spellingbee.

You can create a new spelling bee and call the correct method for a word. This will return an array of suggestions.

s =
s.correct "speling" #=> ["spelling"]

The above example uses spellingbee's default dictionary text, which contains just a few words. To use your own text source:

s = :source_text => 'my_file.txt'
s.correct "speling" #=> ["spelling"]

The source can be any text file that contains all the words that you might expect the spelling corrector to be able to correct.


This gem is based on the Python example in Peter Norvig's article "How to write a spelling corrector". []

Brian Adkins wrote a version of this code in ruby and the logic used within the SpellingBee class is based on that code. []


Copyright (c) 2010 Nithin Bekal, released under the MIT license

Something went wrong with that request. Please try again.