postmodern / ffi-hunspell

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

Support of multi-dictionaries (hunspell -d option) #24

Open nkrot opened 7 years ago

nkrot commented 7 years ago

Hunspell offers a -d option to load various dictionaries (man hunspell). Would it be possible to implement this possibility in ffi/hunspell library?

Multi-dictionaries are useful when only one of the specified dictionaries is base dictionary in terms of hunspell, that is, the one with both .dic and .aff files and all other are only .dic dictionaries. For example, -d option allows the following usage:

hunspell -d de_DE,de_med,de_myown

Why about the following syntax?

FFI::Hunspell.dict(["de_DE", "de_med",  "de_myown"])

Please note the limitations of multi-dictionaries: https://github.com/hunspell/hunspell/issues/348

EDIT: looks like non-merged pull request tries to fix this issue. Which raises an important question if this project is still maintained.

postmodern commented 3 years ago

Note that ffi-hunspell 0.6.0 is out which added Dictionary#add_dic support for adding additional dictionary files to an existing dictionary, but requires a path to the dictionary file.