pepeiborra / fuzzy

Fuzzy string search in Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fuzzy

Fuzzy string search library in Haskell. Uses TextualMonoid from monoid-subclasses to be able to run on different types of strings.

Ported from the JavaScript equivalent mattyork/fuzzy.

Installation

cabal install fuzzy

Usage

> import Text.Fuzzy

> match "fnt" "infinite" "" "" id True
Just ("infinite",3)

> match "hsk" ("Haskell",1995) "<" ">" fst False
Just ("<h>a<s><k>ell",5)

> filter "ML" [("Standard ML", 1990),("OCaml",1996),("Scala",2003)] "<" ">" fst False
[Fuzzy {original = ("Standard ML",1990), rendered = "standard <m><l>", score = 4},Fuzzy {original = ("OCaml",1996), rendered = "oca<m><l>", score = 4}]

> simpleFilter "vm" ["vim", "emacs", "virtual machine"]
["vim","virtual machine"]

> test "brd" "bread"
True

License

MIT

About

Fuzzy string search in Haskell

License:MIT License


Languages

Language:Haskell 100.0%