language-spelling-0.3.2: Various tools to detect/correct mistakes in words

Safe HaskellSafe-Inferred

Language.Phonetic

Contents

Description

"A phonetic algorithm is an algorithm for indexing of words by their pronunciation": https://en.wikipedia.org/wiki/Phonetic_algorithm.

Right now only a very rudimental one is provided, Soundex; plus Encoder, a generic interface.

Synopsis

Types

data Code enc Source

A wrapped ByteString.

Instances

Eq (Code enc) 
Show (Code enc) 

data Alphabet enc Source

A wrapped Set Char.

Instances

Eq (Alphabet enc) 
Show (Alphabet enc) 

class Encoder enc whereSource

Type class for algorithms that encode words based on their pronunciation.

Minimal definition: alphabet, encodeUnsafe.

Methods

alphabet :: Alphabet encSource

The range of characters that the algorithm will accept

encodeUnsafe :: ListLike full Char => full -> Code encSource

Unchecked encoding: if characters not in alphabet are in the word the behaviour is undefined. You should use encode.

encode :: ListLike full Char => full -> Maybe (Code enc)Source

Safe encodeUnsafe: checks that all the characters are in alphabet first.

Instances

Algorithms