[Haskell-cafe] Inecxact map?
Morten Olsen Lysgaard
morten at lysgaard.no
Tue Mar 13 09:15:14 CET 2012
I'm running a project where i want to generate a map of a rather large
data collection. The map is if the form: Data.Map.Map String a
I'd like to be able to do inexact lookups on the map. Firstly, ignore
the difference between upper lower case, that's easy. But secondly, have
a function:
search :: (Num b) => Data.Map.Map String a -> String -> b -> [a]
This function is like the normal lookup, but it takes an extra argument
b. B is the allowed character error rate. That is the Levenstein
distance divided on the length. It should return all the strings that
has an error rate lower that b and in a ordered manner, best first.
Is it possible to design such a datastructure efficiently?
Does there already exist something like this?
If not, where would i begin to create this?
Any advices or knowledge appreciated.
--
Morten
More information about the Haskell-Cafe
mailing list