fuzzyset: Fuzzy set data structure for approximate string matching

[ bsd3, data, library ] [ Propose Tags ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6, 0.1.0.7, 0.1.0.8, 0.1.1, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.3.0, 0.3.1, 0.3.2
Dependencies base (>=4.7 && <5), mtl (>=2.2.2 && <2.5), text (>=2.0.2 && <2.2), text-metrics (>=0.3.2 && <0.5), transformers (>=0.5.6.2 && <0.8), unordered-containers (>=0.2.19.1 && <0.4), vector (>=0.13.0.0 && <0.15) [details]
License BSD-3-Clause
Copyright 2017-present laserpants
Author Heikki Johannes Hildén
Maintainer hildenjohannes@gmail.com
Category Data
Home page https://github.com/laserpants/fuzzyset-haskell#readme
Bug tracker https://github.com/laserpants/fuzzyset-haskell/issues
Source repo head: git clone https://github.com/laserpants/fuzzyset-haskell
Uploaded by arbelos at 2024-03-08T03:13:27Z
Distributions LTSHaskell:0.3.2, NixOS:0.3.2, Stackage:0.3.2
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 7620 total (99 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-03-08 [all 1 reports]

Readme for fuzzyset-0.3.2

[back to package description]

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