Computer Programs

8.1 Edit distance. Write a MATLAB function named edit_distance that computes the Edit distance between two strings. This function takes as inputs (a) the reference string ref_str and (b) the test string test_str. It returns (a) the matching cost edit_cost and (b) the node predecessors matrix pred. Each element of the last matrix stores the coordinates of the predecessor of a node as a complex number, the real part of which stands for the row index and the imaginary part for the column index.

Solution

In the following implementation it is assumed that the reference pattern is associated with the horizontal axis.

8.2. Backtracking ...

Get Pattern Recognition, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.