stemmer-0.2: Haskell bindings to the Snowball stemming library.




Haskell bindings for the Snowball stemming library. This module contains all the low-level functions and are more or less direct translations of the foreign function calls. The stem function expects strings to use UTF-8 encoding.



data Algorithm Source

Available algorithms. For English, English is recommended over Porter.


type Stemmer = Ptr StemmerStructSource

Pointer to a stemmer instance

Low level functions

new :: Algorithm -> IO StemmerSource

Create a new stemmer instance. When you're done using the stemmer, you should delete it, freeing the memory.

delete :: Stemmer -> IO ()Source

Delete a stemmer instance. Don't use it after deleting.

stem :: Stemmer -> String -> IO StringSource

Stem a word using the stemmer instance.


withStemmer :: Algorithm -> (Stemmer -> IO a) -> IO aSource

Perform stemming using a wrapper handling the low-level creation and deletion of the stemmer instance.