Class DamerauLevenshteinDistance

java.lang.Object
org.apache.commons.text.similarity.DamerauLevenshteinDistance
All Implemented Interfaces:
BiFunction<CharSequence,CharSequence,Integer>, EditDistance<Integer>, ObjectSimilarityScore<CharSequence,Integer>, SimilarityScore<Integer>

public class DamerauLevenshteinDistance extends Object implements EditDistance<Integer>
An algorithm for measuring the difference between two character sequences using the Damerau-Levenshtein Distance.

This is the number of changes needed to change one sequence into another, where each change is a single character modification (deletion, insertion, substitution, or transposition of two adjacent characters).

Since:
1.15.0
See Also:
  • Constructor Details

    • DamerauLevenshteinDistance

      Constructs a default instance that uses a version of the algorithm that does not use a threshold parameter.
    • DamerauLevenshteinDistance

      Constructs a new instance. If the threshold is not null, distance calculations will be limited to a maximum length. If the threshold is null, the unlimited version of the algorithm will be used.
      Parameters:
      threshold - If this is null then distances calculations will not be limited. This may not be negative.
  • Method Details