T - type of the tokenpublic final class GeneralizedOverlapCoefficient<T> extends Object implements MultisetMetric<T>
similarity(q,r) = ∣q ∩ r∣ / min{∣q∣, ∣r∣}
Unlike the overlap coefficient the occurrence (cardinality) of an entry is
taken into account. E.g. [hello, world] and
[hello, world, hello, world] would be identical when compared with
the overlap coefficient index but are dissimilar when the generalized version
is used.
This class is immutable and thread-safe.
| Constructor and Description |
|---|
GeneralizedOverlapCoefficient() |
| Modifier and Type | Method and Description |
|---|---|
float |
compare(com.google.common.collect.Multiset<T> a,
com.google.common.collect.Multiset<T> b)
Measures the similarity between multisets a and b.
|
String |
toString() |
public float compare(com.google.common.collect.Multiset<T> a, com.google.common.collect.Multiset<T> b)
MultisetMetric
Results are undefined if a and b are based on different
equivalence relations (as HashMultiset and TreeMultiset
are).
Copyright © 2014–2016. All rights reserved.