public class NGramDistance extends Object implements StringDistance
Constructor and Description |
---|
NGramDistance()
Creates an N-Gram distance measure using n-grams of size 2.
|
NGramDistance(int size)
Creates an N-Gram distance measure using n-grams of the specified size.
|
Modifier and Type | Method and Description |
---|---|
float |
getDistance(String source,
String target)
Returns a float between 0 and 1 based on how similar the specified strings are to one another.
|
public NGramDistance(int size)
size
- The size of the n-gram to be used to compute the string distance.public NGramDistance()
public float getDistance(String source, String target)
StringDistance
getDistance
in interface StringDistance
source
- The first string.target
- The second string.