[chinese][all] We can use three basic operations of "delete", "insert", and "substitute" to convert a string into another one. The

edit distancebetween two strings is defined as the minimum number of the basic operations that are required to converting a string into another. Similarly, we can also define the costs of these operations and then find the required operations for conversion one string to another with the minimum cost.We can also use the concept of DP to compute the edit distance between two strings. Let the optimum-value function ED(

a,b) defined as the edit distance between stringsaandb. Then the recursive formula for ED is shown next, assuming the costs of "delete" and "insert" are 1, while "substitute" is 2.The boundary conditions are ED(

- ED(
ax,by) = ED(a,b) if x = y.- ED(
ax,by) = min(ED(a,b)+2, ED(ax,b)+1, ED(a,by)+1) if x ≠ y.a, []) = len(a), ED([],b) = len(b).

The following example demonstrates a typical result of edit distance of strings "prosperity" and "properties":

As shown in the plot, the circle positions indicate common characters.The next example demonstrates the result of edit distance between "execution" and "intention", which is the example used in 3.11 of "Speech and Language Processing".

Data Clustering and Pattern Recognition (資料分群與樣式辨認)