Skip to content

Instantly share code, notes, and snippets.

@L3viathan
Created September 21, 2017 14:55
Show Gist options
  • Save L3viathan/dab09bee70a0c4df1b5a167808d165c9 to your computer and use it in GitHub Desktop.
Save L3viathan/dab09bee70a0c4df1b5a167808d165c9 to your computer and use it in GitHub Desktop.
Super-simple length-independent word-based Levenshtein distance
def weighted_distance(x, y):
x, y = x.split(), y.split()
length = len(x+y)/2
return editdistance.eval(x, y)/length
@L3viathan
Copy link
Author

Requires pip3 install editdistance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment