Package org.apache.lucene.search.spell
Class LevensteinDistance
- java.lang.Object
-
- org.apache.lucene.search.spell.LevensteinDistance
-
- All Implemented Interfaces:
StringDistance
public final class LevensteinDistance extends java.lang.Object implements StringDistance
Levenstein edit distance class.
-
-
Constructor Summary
Constructors Constructor Description LevensteinDistance()Optimized to run a bit faster than the static getDistance().
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)floatgetDistance(java.lang.String target, java.lang.String other)Returns a float between 0 and 1 based on how similar the specified strings are to one another.inthashCode()java.lang.StringtoString()
-
-
-
Method Detail
-
getDistance
public float getDistance(java.lang.String target, java.lang.String other)Description copied from interface:StringDistanceReturns a float between 0 and 1 based on how similar the specified strings are to one another. Returning a value of 1 means the specified strings are identical and 0 means the string are maximally different.- Specified by:
getDistancein interfaceStringDistance- Parameters:
target- The first string.other- The second string.- Returns:
- a float between 0 and 1 based on how similar the specified strings are to one another.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-