Package squidpony
Class DamerauLevenshteinAlgorithm
java.lang.Object
squidpony.DamerauLevenshteinAlgorithm
public class DamerauLevenshteinAlgorithm extends Object
The Damerau-Levenshtein Algorithm is an extension to the Levenshtein
Algorithm which solves the edit distance problem between a source string and
a target string with the following operations:
- Character Insertion
- Character Deletion
- Character Replacement
- Adjacent Character Swap
- Author:
- Kevin L. Stern
-
Constructor Summary
Constructors Constructor Description DamerauLevenshteinAlgorithm(int deleteCost, int insertCost, int replaceCost, int swapCost)
Constructor. -
Method Summary
Modifier and Type Method Description int
execute(CharSequence source, CharSequence target)
Compute the Damerau-Levenshtein distance between the specified source string and the specified target string.
-
Constructor Details
-
DamerauLevenshteinAlgorithm
Constructor.- Parameters:
deleteCost
- the cost of deleting a character.insertCost
- the cost of inserting a character.replaceCost
- the cost of replacing a character.swapCost
- the cost of swapping two adjacent characters.
-
-
Method Details
-
execute
Compute the Damerau-Levenshtein distance between the specified source string and the specified target string.
-