hunspell

Version, currently 0.1.02 versions

github.com/postmodern/hunspell.cr

Crystal bindings for libhunspell. Crystal port of the Ruby ffi-hunspell gem.

4 stars
0 dependents
License: MIT

Nothing has been indexed for 0.1.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: postmodern/hunspell.cr
    version: ~> 0.1.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.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.

hunspell.cr

Crystal bindings for Hunspell. Crystal port of the Ruby ffi-hunspell gem and should be API compatible.

Installation

  1. 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
  2. Add the dependency to your shard.yml:

    dependencies:
      hunspell:
        github: your-github-user/hunspell.cr
  3. 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

  1. Fork it (https://github.com/postmodern/hunspell.cr/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