Last active
October 28, 2015 18:46
-
-
Save paul-english/8243710d2044584a8c06 to your computer and use it in GitHub Desktop.
Pairwise string distances
This file contains hidden or 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
import Levenshtein as levenshtein | |
import numpy as np | |
def dist(coord): | |
i, j = coord | |
return levenshtein.distance(strings_list[i], strings_list[j]) | |
coords = np.triu_indices(len(strings_list), 1) | |
zipped_coords = zip(*coords) | |
distances = [dist(c) for c in zipped_coords] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment