slib.sml.sm.core.measures.string
Class LevenshteinDistance
java.lang.Object
slib.sml.sm.core.measures.string.LevenshteinDistance
- Direct Known Subclasses:
- LevenshteinSimilarity
public class LevenshteinDistance
- extends Object
Basic implementation of Levenshtein Distance
http://en.wikipedia.org/wiki/Levenshtein_distance
Levenshtein VI (1966).
"Binary codes capable of correcting deletions, insertions, and reversals".
Soviet Physics Doklady 10: 707–10.
Normalized = distance(a,b) / (b.length() > a.length() ? b.length() : a.length());
i.e. distance divided by the length of the longer String
- Author:
- Harispe Sébastien
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LevenshteinDistance
public LevenshteinDistance(boolean normalize)
- Parameters:
normalize
-
LevenshteinDistance
public LevenshteinDistance(double insP,
double delP,
double mismatchP,
boolean normalize)
- Parameters:
insP
- delP
- mismatchP
- normalize
-
distance
public double distance(String a,
String b)
- Parameters:
a
- b
-
- Returns:
Copyright © 2013. All Rights Reserved.