Skip to content

Instantly share code, notes, and snippets.

View giststhebearbear's full-sized avatar

giststhebearbear

View GitHub Profile
@giststhebearbear
giststhebearbear / leven.py
Created November 25, 2012 23:10
Levenshtein-Damerau in Python
def leven(s1, s2, maxDistance):
# get smallest string so our rows are minimized
s1, s2 = (s1, s2) if len(s1) <= len(s2) else (s2, s1)
# set lengths
l1, l2 = len(s1), len(s2)
# We are simulatng an NM matrix where n is the longer string
# and m is the shorter string. By doing this we can minimize
# memory usage to O(M).
# Since we are simulating the matrix we only maintain two rows
[
{ "keys": ["ctrl+alt+right"], "command": "next_view" },
{ "keys": ["ctrl+alt+left"], "command": "prev_view" },
{
"keys": ["alt+shift+left"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.25, 1.0],
"rows": [0.0, 1.0],
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Espresso Libre.tmTheme",
"fade_fold_buttons": false,
//"font_face": "Incosolata",
//"font_size": "12",
"font_face": "Crisp",
"font_size": 9,
"highlight_modified_tabs": true,
"ignored_packages": [],