Learn Before
Concept

Minimum edit distance algorithm

The minimum edit distance algorithm is a dynamic programming algorithm commonly used in evaluating the similarity between strings.

Given two strings, the source string XX of length n, and target string YY of length m, we’ll define D[i,j]D[i, j] as the edit distance between X[1..i]X[1..i] and Y[1..j]Y[1.. j].

  • Initialization: the zeroth row and column is the distance from the empty string
    • D[0,0]=0D[0,0] = 0
    • for each row i from 1 to n do: D[i,0]D[i1,0]+D[i,0] \leftarrow D[i-1,0] + del-cost(source[i])(source[i])
    • for each column j from 1 to m do: D[0,j]D[0,j1]+D[0,j] \leftarrow D[0, j-1] + ins-cost(target[j])(target[j])
  • Recurrence relation:
    • for each row i from 1 to n do:
      • for each column j from 1 to m do:
Image 0

0

1

Updated 2020-08-02

Tags

Data Science

Related
Learn After