@Description(value="Levenshtein distance, normalized by average string length.") @Reference(authors="V. I. Levenshtein", title="Binary codes capable of correcting deletions, insertions and reversals", booktitle="Soviet physics doklady 10", bibkey="journals/misc/Levenshtein66") public class NormalizedLevenshteinDistanceFunction extends java.lang.Object implements PrimitiveDistanceFunction<java.lang.String>
Note: this is no longer a metric, the triangle inequality is violated. Example: d("ab","bc")=1, d("ab", "abc")+d("abc","bc")=0.4+0.4=0.8
Reference:
V. I. Levenshtein
Binary codes capable of correcting deletions, insertions and reversals.
Soviet physics doklady. Vol. 10. 1966.
TODO: add case insensitive flag.
| Modifier and Type | Class and Description |
|---|---|
static class |
NormalizedLevenshteinDistanceFunction.Parameterizer
Parameterization class.
|
| Modifier and Type | Field and Description |
|---|---|
static NormalizedLevenshteinDistanceFunction |
STATIC_SENSITIVE
Static instance, case sensitive.
|
| Constructor and Description |
|---|
NormalizedLevenshteinDistanceFunction()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distance(java.lang.String o1,
java.lang.String o2)
Computes the distance between two given DatabaseObjects according to this
distance function.
|
boolean |
equals(java.lang.Object obj) |
SimpleTypeInformation<? super java.lang.String> |
getInputTypeRestriction()
Get the input data type of the function.
|
int |
hashCode() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitinstantiateisMetric, isSquared, isSymmetricpublic static final NormalizedLevenshteinDistanceFunction STATIC_SENSITIVE
@Deprecated public NormalizedLevenshteinDistanceFunction()
public double distance(java.lang.String o1,
java.lang.String o2)
PrimitiveDistanceFunctiondistance in interface PrimitiveDistanceFunction<java.lang.String>o1 - first DatabaseObjecto2 - second DatabaseObjectpublic SimpleTypeInformation<? super java.lang.String> getInputTypeRestriction()
DistanceFunctiongetInputTypeRestriction in interface DistanceFunction<java.lang.String>getInputTypeRestriction in interface PrimitiveDistanceFunction<java.lang.String>public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2019 ELKI Development Team. License information.