Jisho is a Ruby wrapper for Hunspell.
You can check for misspelled words by calling Jisho.check
:
require 'jisho'
misspellings = Jisho.check 'Thiis sentence has a misspelled word.'
Jisho.check
returns an array of hashes, each containing the misspelled word, the row and column where it is located, and the list of suggestions.
misspellings # => [{:word=>"Thiis", :row=>1, :column=>1, :suggestions=>["Thais", "This", "Thins"]}]
You can also get the unique set of misspelled words:
misspellings.words # => ["Thiis"]
Jisho requires Hunspell and atleast one dictionary. You can install them on Mac OS X via MacPorts:
port install hunspell hunspell-dict-en_US
Or via Homebrew:
brew install hunspell
Debian users can use apt-get
:
apt-get install hunspell hunspell-en-us
Add this line to your application's Gemfile:
gem 'jisho'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jisho
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Create tests and make them pass (
rake test
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request