public class NGramDistance extends java.lang.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(java.lang.String source,
java.lang.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(java.lang.String source, java.lang.String target)
StringDistance
getDistance
in interface StringDistance
source
- The first string.target
- The second string.Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.