Skip to content

cdchapman/hunspell-ffi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hunspell-ffi

A Ruby FFI interface to the Hunspell spelling checker.

“Hunspell is the spell checker of OpenOffice.org and Mozilla Firefox 3 & Thunderbird, Google Chrome, and it is also used by proprietary softwares, like Mac OS X, memoQ, Opera and SDL Trados.”

- http://hunspell.sourceforge.net/

It should work wherever Ruby FFI works (tested on Ruby 1.9.2, 1.8.7, JRuby 1.5.1).

This should be a drop-in replacement for rhunspell (github.com/tiendung/rhunspell), but using ffi.

Installation

Install Hunspell

On Mac OS X: Hunspell (libhunspell) is already installed on OSX 10.6.

On Debian:

apt-get install hunspell

Install the Gem

gem install hunspell-ffi

Usage

require 'hunspell-ffi'
dict = Hunspell.new("path/to/cakes.aff", "path/to/cakes.dic")
dict.spell("Baumkuchen")    # => true  same as #check, #check?
dict.spell("Bomcuken")      # => false
dict.check?("Bomcuken")     # => false
dict.suggest("Baumgurken")  # => ["Baumkuchen"]
dict.suggest("qwss43easd")  # => []

# Modify the run-time dictionary:
dict.add("Geburtstagskuchen")
dict.remove("Fichte")

Authors

Andreas Haller and contributors. Full list of contributors: github.com/ahx/hunspell-ffi/contributors

License

Hereby placed under public domain, do what you want, just do not hold me accountable.

Help wanted

I hear Hunspell has some superpowers like stemming and some that i never even heard of. Maybe you want to help out to bring something of that power into the ruby world. Or maybe we can think of a nice way to find to locate .dict files on a system or something. Anyways, feel free to fork and send pull requests. kthxbye. Andreas.

The source is on GitHub: github.com/ahx/hunspell-ffi

TODOs

Figure out how to use and add hunspell analyzing methods (analyze, stem …)

Test on Windows

About

A Ruby FFI interface to the Hunspell spelling checker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%