Skip to content

Instantly share code, notes, and snippets.

View thotro's full-sized avatar

Thomas Trojer thotro

  • University of Innsbruck
  • Innsbruck, Austria
View GitHub Profile
@thotro
thotro / JaroWinklerScore.java
Created November 14, 2015 21:14
A basic Java version of the Jaro-Winkler distance algorithm for measuring the similarity of Strings. It offers good performance on shorter types of strings like names, etc.
public class JaroWinklerScore {
/**
* Applies the Jaro-Winkler distance algorithm to the given strings, providing information about the
* similarity of them.
*
* @param s1 The first string that gets compared. May be <code>null</node> or empty.
* @param s2 The second string that gets compared. May be <code>null</node> or empty.
* @return The Jaro-Winkler score (between 0.0 and 1.0), with a higher value indicating larger similarity.
*
* @author Thomas Trojer <thomas@trojer.net>