crystal-hunspell
Crystal bindings for Hunspell.
Installation
-
Add the dependency to your
shard.yml
:dependencies: crystal-hunspell: github: mamantoha/crystal-hunspell
-
Run
shards install
Usage
Open a dictionary:
require "hunspell"
# instantiate Hunspell with English affix and dictionary files
hunspell = Hunspell.new("/usr/share/hunspell/en_US.aff", "/usr/share/hunspell/en_US.dic")
Check if a word is valid:
hunspell.spellcheck("crystal")
# => true
hunspell.spellcheck("cristal")
# => false
Find the stems of a word:
hunsell.stem("fishing")
# => ["fishing", "fish"]
Suggest alternate spellings for a word:
hunspell.suggest("arbitrage") hunspell.suggest("crystal")
# => ["arbitrage", "arbitrages", "arbitrager", "arbitraged", "arbitrate"]
Contributing
- Fork it (https://github.com/mamantoha/crystal-hunspell/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Anton Maminov - creator and maintainer