phyllisstein / alp

A Python module for Alfred v2 workflows
174 stars 11 forks source link

fuzzy search #7

Closed jlegewie closed 11 years ago

jlegewie commented 11 years ago

Any interest in adding a fuzzy search function? I have something that I could contribute, which is inspired by the sublime text fuzzy search in the quick panel. The idea is this:

List of strings: NORDLAND 2013 - Amid Fears of Releases RUBIN and Ben 2012 - U.S. Cedes Prisons to Afghanistan

query: noram -> Matches the first one with the bold letters. query: rub2012 -> Matches the second one with the bold letters.

The current function returns a list of matches and ranks them based on a) sequence of characters (matching 'nor' is better then 'nxoxr' and b) the earlier in the string the better.

My current implementation is far from the version in ST but it has served me pretty well and I am sure it can be improved. Just wanted to ask before sending a pull request.

phyllisstein commented 11 years ago

Yes, emphatically yes! I'd love to see how you did it; my attempts with the built-in module were too embarrassing to even publish.