Package org.apache.commons.text.similarity

# Interface SimilarityScore<R>

Type Parameters:
  `R` - The type of similarity score unit.

All Superinterfaces:
  `BiFunction<CharSequence,CharSequence,R>`, `ObjectSimilarityScore<CharSequence,R>`

All Known Subinterfaces:
  `EditDistance<R>`

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

public interface SimilarityScore<R> extends ObjectSimilarityScore<CharSequence,R>
Scores `CharSequence` similarity, like a `String`.

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.

Further, this intended to be BiFunction<CharSequence, CharSequence, R>. The `apply` method accepts a pair of `CharSequence` parameters and returns an `R` type similarity score.

Since:
  1.0

- ## Method Summary

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

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

  `andThen`

- ## Method Details

  - ### apply

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