hunspell-hs-0.1.0.0: Hunspell thread-safe FFI bindings for spell checking.

Copyright(c) Ashutosh Rishi Ranjan 2018
Maintainerashutoshrishi92 at gmail
Safe HaskellNone
LanguageHaskell2010

Language.Hunspell

Contents

Description

 
Synopsis

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

createSpellChecker Source #

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.

Hunspell API mappings

spell :: SpellChecker -> String -> IO Bool Source #

Check for correctness of a word.

suggest :: SpellChecker -> String -> IO [String] Source #

Return spelling suggestions for a word.

stem :: SpellChecker -> String -> IO [String] Source #

Hunspell stemmer function

add :: SpellChecker -> String -> IO () Source #

Add a word to the runtime dictionary.

remove :: SpellChecker -> String -> IO () Source #

Remove a word from the runtime dictionary.