Package one.microstream.chars
Class Levenshtein
- java.lang.Object
-
- one.microstream.chars.Levenshtein
-
public final class Levenshtein extends Object
Simple implementation of the Levenshtein distance algorithm for calculating Levenshtein distance or a Levenshtein-based string similarity.This class provides three overloaded methods for
String
,CharSequence
andchar[]
.
A constantSimilator
function object as well as static convenience methods are provided as well.
-
-
Constructor Summary
Constructors Constructor Description Levenshtein()
-
Method Summary
Modifier and Type Method Description static float
charDistance(char a, char b)
static float
distance(char[] a, char[] b, _charDistance costFunction)
static float
distance(CharSequence a, CharSequence b, _charDistance costFunction)
static float
distance(String a, String b, _charDistance costFunction)
static float
similarity(char[] a, char[] b)
static float
similarity(char[] a, char[] b, _charDistance costFunction)
static float
similarity(CharSequence a, CharSequence b)
static float
similarity(CharSequence a, CharSequence b, _charDistance costFunction)
static float
similarity(String a, String b)
static float
similarity(String a, String b, _charDistance costFunction)
static double
similiarity(String a, String b)
static double
substringSimilarity(String s1, String s2)
static double
upperCaseSimiliarity(String a, String b)
-
-
-
Method Detail
-
charDistance
public static final float charDistance(char a, char b)
-
distance
public static final float distance(String a, String b, _charDistance costFunction)
-
distance
public static final float distance(CharSequence a, CharSequence b, _charDistance costFunction)
-
distance
public static final float distance(char[] a, char[] b, _charDistance costFunction)
-
similarity
public static final float similarity(String a, String b, _charDistance costFunction)
-
similarity
public static final float similarity(CharSequence a, CharSequence b, _charDistance costFunction)
-
similarity
public static final float similarity(char[] a, char[] b, _charDistance costFunction)
-
similarity
public static final float similarity(CharSequence a, CharSequence b)
-
similarity
public static final float similarity(char[] a, char[] b)
-
-