1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

add ignore_case to fuzzy matching

This commit is contained in:
William Ting 2013-12-17 16:12:26 -06:00
parent 1e4ca4d67e
commit c259978585

View File

@ -254,8 +254,14 @@ def match_fuzzy(needles, haystack, ignore_case=False):
This is a weak heuristic and be used as a last resort to find matches. This is a weak heuristic and be used as a last resort to find matches.
""" """
needle = last(needles)
end_dir = lambda path: last(os.path.split(path)) end_dir = lambda path: last(os.path.split(path))
if ignore_case:
needle = last(needles).lower()
match_percent = lambda entry: SequenceMatcher(
a=needle,
b=end_dir(entry.path.lower())).ratio()
else:
needle = last(needles)
match_percent = lambda entry: SequenceMatcher( match_percent = lambda entry: SequenceMatcher(
a=needle, a=needle,
b=end_dir(entry.path)).ratio() b=end_dir(entry.path)).ratio()