Interface SimilarityScore<R>
-
- Type Parameters:
R
- The type of similarity score unit used by this EditDistance.
- All Known Subinterfaces:
EditDistance<R>
- All Known Implementing Classes:
CosineDistance
,HammingDistance
,IntersectionSimilarity
,JaccardDistance
,JaccardSimilarity
,JaroWinklerDistance
,JaroWinklerSimilarity
,LevenshteinDetailedDistance
,LevenshteinDistance
,LongestCommonSubsequence
,LongestCommonSubsequenceDistance
public interface SimilarityScore<R>
Interface for the concept of a string similarity score.A string similarity score is intended to have some of the properties of a metric, yet allowing for exceptions, namely the Jaro-Winkler similarity score.
We Define a SimilarityScore to be a function
d: [X * X] -> [0, INFINITY)
with the following properties:d(x,y) >= 0
, non-negativity or separation axiomd(x,y) == d(y,x)
, symmetry.
Notice, these are two of the properties that contribute to d being a metric.
Further, this intended to be BiFunction<CharSequence, CharSequence, R>. The
apply
method accepts a pair ofCharSequence
parameters and returns anR
type similarity score. We have omitted the explicit statement of extending BiFunction due to it only being implemented in Java 1.8, and we wish to maintain Java 1.7 compatibility.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description R
apply(java.lang.CharSequence left, java.lang.CharSequence right)
Compares two CharSequences.
-
-
-
Method Detail
-
apply
R apply(java.lang.CharSequence left, java.lang.CharSequence right)
Compares two CharSequences.- Parameters:
left
- the first CharSequenceright
- the second CharSequence- Returns:
- The similarity score between two CharSequences
-
-