Created
September 21, 2017 14:55
-
-
Save L3viathan/dab09bee70a0c4df1b5a167808d165c9 to your computer and use it in GitHub Desktop.
Super-simple length-independent word-based Levenshtein distance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def weighted_distance(x, y): | |
x, y = x.split(), y.split() | |
length = len(x+y)/2 | |
return editdistance.eval(x, y)/length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires
pip3 install editdistance