module
Edits::DamerauLevenshtein
Overview
Damerau-Levenshtein edit distance.
Determines distance between two strings by counting edits, identifying:
- Insertion
- Deletion
- Substitution
- Adjacent transposition
Extended Modules
Defined in:
edits/damerau_levenshtein.crClass Method Summary
-
.distance(str1, str2, max : Int) : Int32
Calculate the Damerau-Levenshtein distance of two sequences, bounded by a maximum value.
-
.distance(str1, str2) : Int32
Calculate the Damerau-Levenshtein distance of two sequences.
Class Method Detail
def self.distance(str1, str2, max : Int) : Int32
#
Calculate the Damerau-Levenshtein distance of two sequences, bounded by a maximum value.
DamerauLevenshtein.distance("acer", "earn") # => 3
DamerauLevenshtein.distance("acer", "earn", 2) # => 2
def self.distance(str1, str2) : Int32
#
Calculate the Damerau-Levenshtein distance of two sequences.
DamerauLevenshtein.distance("acer", "earn") # => 3