StringDistancepublic class NGramDistance extends Object implements StringDistance
| Constructor | 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 | 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)
StringDistancegetDistance in interface StringDistancesource - The first string.target - The second string.Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.