T - the type of the elements extracted from the character sequencepublic class IntersectionSimilarity<T> extends Object implements SimilarityScore<IntersectionResult>
It is assumed that the type T correctly conforms to the requirements for storage
within a Set or HashMap. Ideally the type is immutable and implements
Object.equals(Object) and Object.hashCode().
| Constructor and Description |
|---|
IntersectionSimilarity(Function<CharSequence,Collection<T>> converter)
Create a new intersection similarity using the provided converter.
|
| Modifier and Type | Method and Description |
|---|---|
IntersectionResult |
apply(CharSequence left,
CharSequence right)
Calculates the intersection of two character sequences passed as input.
|
public IntersectionSimilarity(Function<CharSequence,Collection<T>> converter)
If the converter returns a Set then the intersection result will
not include duplicates. Any other Collection is used to produce a result
that will include duplicates in the intersect and union.
converter - the converter used to create the elements from the charactersIllegalArgumentException - if the converter is nullpublic IntersectionResult apply(CharSequence left, CharSequence right)
apply in interface SimilarityScore<IntersectionResult>left - first character sequenceright - second character sequenceIllegalArgumentException - if either input sequence is nullCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.