https://github.com/postmodern/ffi-hunspell
Ruby FFI bindings for Hunspell.
https://github.com/postmodern/ffi-hunspell
Last synced: 8 months ago
JSON representation
Ruby FFI bindings for Hunspell.
- Host: GitHub
- URL: https://github.com/postmodern/ffi-hunspell
- Owner: postmodern
- License: mit
- Created: 2010-10-06T05:41:34.000Z (about 15 years ago)
- Default Branch: main
- Last Pushed: 2023-12-28T05:06:50.000Z (almost 2 years ago)
- Last Synced: 2025-03-31T16:16:29.755Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 119 KB
- Stars: 49
- Watchers: 4
- Forks: 23
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE.txt
Awesome Lists containing this project
- nlp-with-ruby - ffi-hunspell - (High Level Tasks / Spelling and Error Correction)
README
# ffi-hunspell
[](https://github.com/postmodern/ffi-hunspell/actions/workflows/ruby.yml)
[](https://codeclimate.com/github/postmodern/ffi-hunspell)
* [Source](https://github.com/postmodern/ffi-hunspell)
* [Issues](https://github.com/postmodern/ffi-hunspell/issues)
* [Documentation](http://rubydoc.info/gems/ffi-hunspell/frames)
## Description
Ruby FFI bindings for [Hunspell][libhunspell].
## Examples
Open a dictionary:
```rb
require 'ffi/hunspell'
FFI::Hunspell.dict do |dict|
# ...
end
FFI::Hunspell.dict('en_GB') do |dict|
# ...
end
dict = FFI::Hunspell.dict('en_GB')
# ...
dict.close
```
Check if a word is valid:
```rb
dict.check?('dog')
# => true
dict.check?('d0g')
# => false
```
Find the stems of a word:
```rb
dict.stem('dogs')
# => ["dog"]
```
Suggest alternate spellings for a word:
```rb
dict.suggest('arbitrage')
# => ["arbitrage", "arbitrages", "arbitrager", "arbitraged", "arbitrate"]
```
## Requirements
* [libhunspell] >= 1.2.0, <= 1.7.0
* [ffi] ~> 1.0
## Install
```sh
$ gem install ffi-hunspell
```
### libhunspell
* Debian / Ubuntu:
$ sudo apt install libhunspell-dev hunspell-en-us
* RedHat / Fedora:
$ sudo dnf install hunspell-devel hunspell-en
* macOS:
$ brew install hunspell
## License
Copyright (c) 2010-2021 Hal Brodigan
See {file:LICENSE.txt} for license information.
[libhunspell]: http://hunspell.github.io/
[ffi]: https://github.com/ffi/ffi#readme