org.apache.commons.text.similarity

## 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, JaccardDistance, JaccardSimilarity, JaroWinklerDistance, 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 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. We have ommitted 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 and Description
    --- | ---
    `R` | `apply(CharSequence left, CharSequence right)` Compares two CharSequences.

- - ### Method Detail

    - #### apply

          R apply(CharSequence left,
                  CharSequence right)

      Compares two CharSequences.
      Parameters:
        `left` - the first CharSequence
        `right` - the second CharSequence
      Returns:
        the similarity score between two CharSequences

Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.