Pages

Sunday, October 3, 2010

Fuzzy Search In Emacs

fuzzy.el provides a super fuzzy search capacity. Save the code linked below to somewhere on your elisp path, add the two lines below to your .emacs and now C-s (isearch-forward) will become "fuzzy" after the first miss for the item you are searching for. You can customise the "fuzzy" group to change the fuzziness. This module is part of the superb auto-complete suite - recommended.


(require 'fuzzy)
(turn-on-fuzzy-isearch)




--
My Emacs Files At GitHub

3 comments:

  1. Don't most people think of fuzzy search as c-a-d would match cat-and-dog? I'm not sure what's wrong with fuzzy.el but it doesn't seem like fuzzy search I'm used to.

    ReplyDelete
  2. I would be surprised if it matched that. If its too loose then its would match everything and become a nuisance. I guess you could contact the package owner and ask about tweaking the algorithm a little. Sometimes it doesnt match things I thought it would - e.g "cet" for "cat".

    ReplyDelete
  3. looked inside the code, it uses
    http://en.wikipedia.org/wiki/Jaro-Winkler_distance
    so MARTHA and MARHTA match.
    i'll use it.

    ReplyDelete