postmodern / ffi-hunspell

Ruby FFI bindings for Hunspell.
MIT License
48 stars 24 forks source link

Cannot find dictionary #3

Closed jackkinsella closed 9 years ago

jackkinsella commented 12 years ago

Hey,

Looking forward to adding your gem to my app, but I'm running into trouble running it on a mac. How do you install dictionaries? Is there a particular format I should be looking for? I'm new to the NLP world so sorry if these are newbie questions.

FFI::Hunspell.dict('en_GB') {|d| d.check? "dog"} RuntimeError: unable to find the dictionary "en_GB" in any of the directories

Kind Regards, Jack

iwasrobbed commented 9 years ago

Leaving this here for others:

By default, dictionaries are stored locally in the user's directory under a folder name .hunspell_default (see https://github.com/postmodern/ffi-hunspell/blob/master/lib/ffi/hunspell/hunspell.rb#L65). So on Mac OS X, it will be ~/.hunspell_default

You can download the actual dictionary files from the OpenOffice extensions website and just rename the downloaded files so their file extension is .zip instead of .oxt. Within that zip file, you'll find a pair of files for each language with .aff and .dic file extensions which you'll need to place in the directory noted above.

postmodern commented 9 years ago

On Linux distros the dictionaries are packaged separately. See http://packages.ubuntu.com/search?keywords=hunspell-&searchon=names&suite=trusty&section=all or https://admin.fedoraproject.org/pkgdb/packages/hunspell-*/

ninjarabbi commented 7 years ago

I just installed the gem (on a mac) and it's still unclear what I need to do to get the basic english dictionary. If I have to download a separate file and put it somewhere, how would that work in a production environment? Or something like Heroku, where you don't have direct access to the file system?