hunspell
Version, currently 0.4.09 versions
github.com/mamantoha/crystal-hunspell
Crystal bindings for Hunspell.
8 stars
0 dependents
License: MIT
Nothing has been indexed for 0.4.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
hunspell:
github: mamantoha/crystal-hunspell
version: ~> 0.4.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.4.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# crystal-hunspell
[](https://github.com/mamantoha/crystal-hunspell/actions/workflows/ci.yml)
[](https://github.com/mamantoha/crystal-hunspell/releases)
[](https://github.com/mamantoha/crystal-hunspell/blob/master/LICENSE)
Crystal bindings for Hunspell.
## Installation
Before installing `crystal-hunspell` ensure you have [hunspell](https://github.com/hunspell/hunspell) already installed:
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
hunspell:
github: mamantoha/crystal-hunspell
```
2. Run `shards install`
## Usage
The library has been tested with Hunspell version 1.7.2.
```crystal
require "hunspell"
```
Open a dictionary:
```crystal
hunspell = Hunspell.new("/usr/share/hunspell/en_US.aff", "/usr/share/hunspell/en_US.dic")
```
or
```crystal
hunspell = Hunspell.new("en_US")
```
Ensure to close `Hunspell` instance after using.
```crystal
hunspell.close
```
Below are some simple examples for how to use the repository.
### Spelling
It's a simple task to ask if a particular word is in the dictionary.
```crystal
hunspell.spell?("correct")
# => true
hunspell.spell?("incorect")
# => false
```
This will only ever return `true` or `false`, and won't give suggestions about why it might be wrong. It also depends on your choice of dictionary.
### Suggestions
If you want to get a suggestion from Hunspell, it can provide a corrected label given a basestring input.
```crystal
hunspell.suggest("arbitrage")
# => ["arbitrage", "arbitrages", "arbitrager", "arbitraged", "arbitrate"]
```
### Suffix Match
```crystal
hunspell.suffix_suggest("do")
# => ["doing", "doth", "doer", "dos", "do's", "doings", "doers"]
```
### Stemming
The module can also stem words, providing the stems for pluralization and other inflections.
```crystal
hunsell.stem("fishing")
# => ["fishing", "fish"]
```
### Analyze
Like stemming but return morphological analysis of the input instead.
```crystal
hunspell.analyze("permanently")
# => [" st:permanent fl:Y"]
```
### Bulk Requests
You can also request bulk actions against Hunspell. Currently `suggest`, `suffix_suggest`, `stem`, and `analyze` are bulk requestable.
```crystal
hunspell.bulk_suggest(["correct", "incorect"])
# => {"correct" => ["correct", "corrects", "cor rect", "cor-rect"],
# "incorect" => ["incorrect", "correction", "corrector", "injector", "correct"]}
hunspell.bulk_suffix_suggest(["cat", "do"])
# => {"cat" => ["cats", "cat's"],
# "do" => ["doing", "doth", "doer", "dos", "do's", "doings", "doers"]}
hunspell.bulk_stem(["stems", "currencies"])
# => {"stems" => ["stem"], "currencies" => ["currency"]}
hunspell.bulk_analyze(["dog", "permanently"])
# => {"dog" => [" st:dog"], "permanently" => [" st:permanent fl:Y"]}
```
## Development
```
sudo apt install libclang-dev libhunspell-dev
```
Generate new bindings for Hunspell
```console
crystal ./lib/crystal_lib/src/main.cr src/hunspell/lib_hunspell.cr.in > src/hunspell/lib_hunspell.cr
```
## Contributing
1. Fork it (<https://github.com/mamantoha/crystal-hunspell/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.4.0- Tagged
- Jul 1, 2026
- Commit
99059e40c8f7- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/mamantoha/crystal-hunspell
Metadata
- Created
- Aug 13, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 9