Skip to content
A Ruby binding for the Aspell spelling checker
C Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
ext
lib that description was wrong Aug 3, 2007
test Enforce argument types better. Dec 2, 2011
.gitignore Adding git ignore file Jun 19, 2010
CHANGELOG Enforce argument types better. Dec 3, 2011
LICENSE Make GPL2 look less ridiculous. Feb 5, 2008
Manifest Manifest Dec 2, 2011
README.rdoc Update master Jun 21, 2012
Rakefile Project Feb 19, 2012

README.rdoc

raspell

An interface binding for the Aspell spelling checker.

Deprecated

This gem is unmaintained. Please use ffi-aspell instead.

License

Copyright 2007-2012 Cloudburst, LLC. Licensed under the GPL 2.0. See included LICENSE file. Portions copyright 2005 Matthias Veit, Biro Eszter and used with permission.

Requirements

Raspell requires Aspell version 0.6 (www.aspell.net) and at least one Aspell dictionary.

MacPorts:

port install aspell aspell-dict-en

Homebrew:

brew install aspell --lang=en

Ubuntu:

apt-get install aspell libaspell-dev aspell-en

Installation

Mac:

gem install raspell -- --with-opt-dir=/opt/local

Ubuntu:

gem install raspell

Usage

Aspell lets you check words and suggest corrections. For example:

require 'rubygems'
require 'raspell'

speller = Aspell.new("en_US")
speller.suggestion_mode = Aspell::NORMAL

string = "my haert wil go on"

string.gsub(/[\w\']+/) do |word| 
  if !speller.check(word) 
    # word is wrong
    puts "Possible correction for #{word}:"
    puts speller.suggest(word).first
  end
end

This outputs:

Possible correction for haert:
heart
Possible correction for wil:
Will

Note that suggest returns an array of suggestions even for words that are correctly spelled.

Options

The most useful options are suggestion_mode, and the passthrough option ignore_case. Passthrough options have to be set as so:

speller.set_option("ignore-case", "true")

See aspell.net/man-html/The-Options.html for a list of the passthrough options.

Reporting problems

The support forum is here.

Patches and contributions are very welcome. Please note that contributors are required to assign copyright for their additions to Cloudburst, LLC.

Futher resources

Something went wrong with that request. Please try again.