OptimalStringAlignment

Implementation of the Optimal String Alignment (sometimes called the restricted edit distance) variant of the Damerau-Levenshtein distance.

The difference between the two algorithms consists in that the Optimal String Alignment algorithm computes the number of edit operations needed to make the strings equal under the condition that no substring is edited more than once, whereas Damerau-Levenshtein presents no such restriction.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun distance(first: String, second: String): Int

Compute the distance between strings: the minimum number of operations needed to transform one string into the other (insertion, deletion, substitution of a single character, or a transposition of two adjacent characters) while no substring is edited more than once.