Description
Fuzzy set data structure for approximate string matching.
Description
Please see the README on GitHub at https://github.com/laserpants/fuzzyset-haskell#readme
README.md
fuzzyset-haskell
A fuzzy string set data structure for approximate string matching.
In a nutshell:
- Add data to the set (see
add
,add_
,addMany
, andaddMany_
) - Query the set (see
find
,findMin
,findOne
,findOneMin
,closestMatchMin
, andclosestMatch
)
Refer to the Haddock docs for details.
Example
{-# LANGUAGE OverloadedStrings #-}
module Main where ```
import Control.Monad.Trans.Class (lift)
import Data.Text (Text)
import Data.FuzzySet (FuzzySearchT, add_, closestMatch, runDefaultFuzzySearchT)
findMovie :: Text -> FuzzySearchT IO (Maybe Text)
findMovie = closestMatch
prog :: FuzzySearchT IO ()
prog = do
add_ "Jurassic Park"
add_ "Terminator"
add_ "The Matrix"
result <- findMovie "The Percolator"
lift (print result)
main :: IO ()
main = runDefaultFuzzySearchT prog