| Copyright | (c) Ashutosh Rishi Ranjan 2018 |
|---|---|
| Maintainer | ashutoshrishi92 at gmail |
| Safe Haskell | None |
| Language | Haskell2010 |
Language.Hunspell
Description
Synopsis
- createSpellChecker :: String -> String -> IO SpellChecker
- data SpellChecker
- spell :: SpellChecker -> String -> IO Bool
- suggest :: SpellChecker -> String -> IO [String]
- stem :: SpellChecker -> String -> IO [String]
- add :: SpellChecker -> String -> IO ()
- remove :: SpellChecker -> String -> IO ()
Usage
The functions exported try to match the Hunspell API one-to-one.
>>>checker <- createSpellChecker "en_GB.aff" "en_GB.buf">>>suggest checker "splling"["spelling", ...]
Usage with threads
Initialise a SpellChecker instance before you spawn your
threads. After which, a SpellChecker instance can be used
safely across the threads.
Hunspell FFI requirements
This library expects that GHC can find the Hunspell shared library.
On Linux you need to install the libhunspell-dev package from
your package manager:
sudo apt-get install libhunspell-dev
On Macos you can install hunspell from brew since the default
package config looks into the Homebrew include and lib dirs:
brew install hunspell
Creation
Arguments
| :: String | .aff file path |
| -> String | .dic file path |
| -> IO SpellChecker |
Initialise a new SpellChecker with the '.aff' and '.dic'
dictionary files.
data SpellChecker Source #
Main type to hold a TMVar wrapped reference to the Hunspell
handle pointer.