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

Package org.apache.commons.text.similarity

# Interface EditDistance<R>

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

All Superinterfaces:
  `SimilarityScore<R>`

All Known Implementing Classes:
  `CosineDistance`, `HammingDistance`, `JaccardDistance`, `JaroWinklerDistance`, `LevenshteinDetailedDistance`, `LevenshteinDistance`, `LongestCommonSubsequenceDistance`

public interface EditDistance<R> extends SimilarityScore<R>
Interface for Edit Distances.

An edit distance is a formal metric on the Kleene closure (`X<sup>*</sup>`) over an alphabet (`X`). Note, that a metric on a set `S` is a function `d: [S * S] -&gt; [0, INFINITY)` such that the following hold for `x,y,z` in the set `S`:

- `d(x,y) &gt;= 0`, non-negativity or separation axiom
- `d(x,y) == 0`, if and only if, `x == y`
- `d(x,y) == d(y,x)`, symmetry, and
- `d(x,z) &lt;= d(x,y) + d(y,z)`, the triangle inequality

This is a 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.

- ## Method Details

  - ### apply

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