T - type of tokenpublic final class Identity<T> extends Object implements Metric<T>, Distance<T>
similarity(a,b) = equals(a,b) ? 1.0f : 0.0f
distance(a,b) = equals(a,b) ? 0.0f : 1.0f
This class is immutable and thread-safe.
| Constructor and Description |
|---|
Identity() |
| Modifier and Type | Method and Description |
|---|---|
float |
compare(T a,
T b)
Measures the similarity between a and b.
|
float |
distance(T a,
T b)
Measures the distance between a and b.
|
String |
toString() |
public float compare(T a, T b)
Metric0.0 indicates that
a and b are dissimilar, a value of 1.0 indicates
they are similar.public float distance(T a, T b)
Distance0.0 indicates that a and
b are similar.Copyright © 2014–2016. All rights reserved.