hunspell.cr
hunspell.cr
- Source
- Issues
- Documentation
- [Email](postmodern.mod3 at gmail.com)
Crystal bindings for Hunspell. Crystal port of the Ruby ffi-hunspell gem and should be API compatible.
Installation
-
Install
libhunspell
-
Debian / Ubuntu:
$ sudo apt install libhunspell-dev hunspell-en-us
-
RedHat / Fedora:
$ sudo dnf install hunspell-devel hunspell-en
-
macOS:
$ brew install hunspell
-
-
Add the dependency to your
shard.yml
:dependencies: hunspell: github: your-github-user/hunspell.cr
-
Run
shards install
Examples
Open a dictionary:
require "hunspell"
Hunspell.dict do |dict|
# ...
end
Hunspell.dict("en_GB") do |dict|
# ...
end
dict = Hunspell.dict("en_GB")
# ...
dict.close
Check if a word is valid:
dict.check?("dog")
# => true
dict.check?("d0g")
# => false
Find the stems of a word:
dict.stem("dogs")
# => ["dog"]
Suggest alternate spellings for a word:
dict.suggest("arbitrage")
# => ["arbitrage", "arbitrages", "arbitrager", "arbitraged", "arbitrate"]
Development
After installing libhunspell
(see Installation):
$ shards install
$ crystal spec
Contributing
- Fork it (https://github.com/postmodern/hunspell.cr/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
- Postmodern - creator and maintainer
Repository
hunspell.cr
Owner
Statistic
- 4
- 1
- 0
- 0
- 1
- over 3 years ago
- February 6, 2021
License
MIT License
Links
Synced at
Thu, 07 Nov 2024 11:13:42 GMT
Languages