ObjectSimilarityScore (Apache Commons Text 1.13.0 API)
Description: declaration: package: org.apache.commons.text.similarity, interface: ObjectSimilarityScore

Package org.apache.commons.text.similarity

# Interface ObjectSimilarityScore<T,R>

Type Parameters:
  `T` - Input type
  `R` - The type of similarity score unit used by this score.

All Superinterfaces:
  `BiFunction<T,T,R>`

All Known Subinterfaces:
  `EditDistance<R>`, `SimilarityScore<R>`

All Known Implementing Classes:
  `CosineDistance`, `HammingDistance`, `IntersectionSimilarity`, `JaccardDistance`, `JaccardSimilarity`, `JaroWinklerDistance`, `JaroWinklerSimilarity`, `LevenshteinDetailedDistance`, `LevenshteinDistance`, `LongestCommonSubsequence`, `LongestCommonSubsequenceDistance`

public interface ObjectSimilarityScore<T,R> extends BiFunction<T,T,R>
Scores the similarity between two `Object`s of the same type.

A string similarity score is intended to have some of the properties of a metric, yet allowing for exceptions, like the Jaro-Winkler similarity score.

A similarity score is the function `d: [X * X] -&gt; [0, INFINITY)` with the following properties:

- `d(x,y) &gt;= 0`, non-negativity or separation axiom
- `d(x,y) == d(y,x)`, symmetry.

Notice, these are two of the properties that contribute to `d` being a metric.

Since:
  1.13.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `R`
  `apply(T left, T right)`
  Compares two Objects.

  ### Methods inherited from interface java.util.function.BiFunction

  `andThen`

- ## Method Details

  - ### apply

    R apply(T left, T right)
    Compares two Objects.
    Specified by:
      `apply` in interface `BiFunction<T,T,R>`
    Parameters:
      `left` - the "left" or "first" input.
      `right` - the "right" or "second" input.
    Returns:
      The similarity score between two Objects.