How to use the textdistance.damerau_levenshtein function in textdistance

To help you get started, we’ve selected a few textdistance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vin-nag / GANs-n-reels / src / Model / analysis.py View on Github external
def get_stats(arr, title):
    data_similarities = []
    num = 1
    for i in range(len(arr) - 2):
        for j in range(i + 1, len(arr) - 1):
            num += 1
            print('iteration ', num, ' of ', ( len(arr) * (len(arr) - 1)))
            data_similarities.append(textdistance.damerau_levenshtein.normalized_distance(arr[i], arr[j]))

    np.save(title+'.npy', data_similarities)
    #print_stats(data_similarities, title)
github AlexYangLi / NLI_Keras / utils / features.py View on Github external
def other_distance(s1, s2):
    return [textdistance.hamming.normalized_similarity(s1, s2),
            textdistance.mlipns.normalized_similarity(s1, s2),
            textdistance.damerau_levenshtein.normalized_similarity(s1, s2),
            textdistance.strcmp95.normalized_similarity(s1, s2),
            textdistance.needleman_wunsch.normalized_similarity(s1, s2),
            textdistance.gotoh.normalized_similarity(s1, s2),
            textdistance.smith_waterman.normalized_similarity(s1, s2),
            textdistance.ratcliff_obershelp.normalized_similarity(s1, s2)]
github KI-labs / kaos / cli / kaos_cli / utils / validators.py View on Github external
    return list(filter(lambda t: textdistance.damerau_levenshtein.distance(t, term) <= 2, dictionary))