Jaro-Winkler Distance

3.0.0 · active · verified Wed Apr 15

pyjarowinkler is a Python library that calculates the Jaro-Winkler Distance, a measure of similarity between two strings. It's useful for tasks like spell-checking, record linkage, and data deduplication. The current version is 3.0.0, and it has a reasonably active release cadence.

Warnings

Install

Imports

Quickstart

This example demonstrates how to import and use the `jaro_winkler_distance` function to calculate the similarity between two strings. The score ranges from 0 (no similarity) to 1 (exact match).

from jarowinkler import jaro_winkler_distance

string1 = "MARTHA"
string2 = "MARHTA"

similarity_score = jaro_winkler_distance(string1, string2)
print(f"Jaro-Winkler Similarity between '{string1}' and '{string2}': {similarity_score}")

string3 = "DWAYNE"
string4 = "DUANE"
similarity_score_2 = jaro_winkler_distance(string3, string4)
print(f"Jaro-Winkler Similarity between '{string3}' and '{string4}': {similarity_score_2}")

view raw JSON →