Please answer the following using PYTHON, show code and results. Please provided your own answer, not someone else's or just a copy from somewhere. If you don't know the answer, please do not answer it. Thank you
Recall that edit distance is used to quantify the dissimilarity of two strings.This is done by counting the minimum number of operations required to transform one string into the other.
The operations we will consider are:
delete a character (Hello -> ello)
insert a character (ello -> Hello)
substitute a character (top -> bop)
We apply a penalty of 1 for each of these operations.
Example:
string1: Hello
string2: elllo
edit_distance(Hello,elllo) = 2
Starting with elllo for example:elllo -> Helllo (insert H: +1)Helllo -> Hello (delete l: +1)
The strings now match after two operations.
Write a function that take two strings as input, and computes and returns their edit distance. Use a matrix (as in LCS calculations) to track results, and have the function print the matrix.
Compute edit distance between Bellman and empty string
Compute edit distance between test and test
Compute edit distance between mailman and namliam
Show each step of the process to change mailman to namliam. This should verify the edit distance. You might find your solution from part d (above) helpful.
Please answer the following using PYTHON, show code and results. Please provided your own answer, not someone else's or
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am