postmodern / ffi-hunspell

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

Added words are not stored #12

Open ghost opened 9 years ago

ghost commented 9 years ago

If I add a word to a dictionary it is only available as long as the dictionary is not closed.

irb(main):020:0* dict = FFI::Hunspell.dict 'de_DE' => #<FFI::Hunspell::Dictionary:0x00000001eaeee8 @ptr=#> irb(main):021:0> dict.check? 'foo' => false irb(main):022:0> dict.add 'foo' => 0 irb(main):023:0> dict.check? 'foo' => true irb(main):024:0> dict.close => nil irb(main):025:0> dict = FFI::Hunspell.dict 'de_DE' => #<FFI::Hunspell::Dictionary:0x00000001e1d3f8 @ptr=#> irb(main):026:0> dict.check? 'foo' => false

because, there is nothing like a save/store or flush method, I expect, that additions to the dictionary would be saved while closing, but that does not work. Is there an other way to save the dicts?

postmodern commented 9 years ago

I believe this is intentionally part of hunspell's design. They assume a text-editor will maintain it's own list of "Remembered" words that are loaded into the dictionary on startup. Maybe we should add a convenience method that adds the contents of a file to the dictionary?

ghost commented 9 years ago

Am 20.06.2015 um 22:01 schrieb Postmodern:

I believe this is intentionally part of hunspell's design. They assume a text-editor will maintain it's own list of "Remembered" words that are loaded into the dictionary on startup. Maybe we should add a convenience method that adds the contents of a file to the dictionary?

I think that would be useful, as also a convenience method for storing the dictionary to a file would be.