Hi,

I wrote a set of functions to compare 2 words managing the keyboard 
mistakes. The common mistakes are insertion, deletion, substitution or 
inversion.

It can be useful for searching name, product reference, city ....

For example, if you want to let 2 errors in an input, you can do:

;; a name 
(candidates? "hickey" "hikey" 3)
 --> true

(candidates? "hickey" "hitchock" 3)
 --> false

;; a city
(candidates? "montrouge" "monrouge" 3)
  --> true

;; a brand
(candidates? "google" "googel" 3)
  --> true

I used lazy sequence to avoid compare the words completely if they' re very 
different. Thus,
(candidates? "hickey" "jobs" 3)
  --> returns false when the third error is found.

The code is on gist:
https://gist.github.com/chrix75/6262565


Christian

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to