fuzzyset

Fuzzy set data structure for approximate string matching

https://github.com/laserpants/fuzzyset-haskell#readme

Version on this page:0.3.1
LTS Haskell 22.21:0.3.2
Stackage Nightly 2024-05-06:0.3.2
Latest on Hackage:0.3.2

See all snapshots fuzzyset appears in

BSD-3-Clause licensed by Heikki Johannes Hildén
Maintained by [email protected]
This version can be pinned in stack with:fuzzyset-0.3.1@sha256:344e16deedb43da5cabae558450e5710843cff7ac2f3073be9db453c6f3a3fb7,2373

fuzzyset-haskell

Haskell CI License Language Hackage

A fuzzy string set data structure for approximate string matching.

In a nutshell:

  1. Add data to the set (see add, add_, addMany, and addMany_)
  2. Query the set (see find, findMin, findOne, findOneMin, closestMatchMin, and closestMatch)

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