editDistance

Edit distance (ED) via dynamic programming

Contents

Syntax

Description

minDist = editDistance(str1, str2) returns the edit distance between strings str1 and str2, assuming the costs for insertion, deletion, and substitution are 1, 1, and 2, respectively.

minDist = editDistance(a, b, costVec) specifies the cost via costVec=[substitution, insertion, deletion].

minDist = editDistance(a, b, costVec, plotOpt) display the optimum path on the DP table.

[minDist, edPath, edTable] = editDistance(a, b, ...) also returns the optimum path of dynamic programming in edPath, and the resulting table in edTable.

Example

str1='execution';
str2='intention';
costVec=[2, 1, 1];
plotOpt=1;
[minDist, edPath, edTable] = editDistance(str1, str2, costVec, plotOpt);

See Also

lcs, dpPathPlot4strMatch.


Top page   Next: dtwPathPlot.m   Prev:endPointDetect.m