Please answer the following using PYTHON, show code and results. Please provide your own answer, not someone else's or j
Posted: Mon Jul 11, 2022 9:49 am
Please answer the following using PYTHON,show code and results. Please provide your own answer, notsomeone else's or just a copy from somewhere. If you don't know theanswer, please do not answer it. Thank you
Recall that edit distance is used to quantifythe dissimilarity of two strings.This is done by counting the minimum number of operations requiredto 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 computesand returns their edit distance. Use a matrix (as in LCScalculations) to track results, and have the function print thematrix.
Compute edit distancebetween Bellman and empty string
Compute edit distancebetween test and test
Compute edit distancebetween mailman and namliam
Show each step of the process tochange mailman to namliam.This should verify the edit distance. You might find your solutionfrom part d (above) helpful.
Recall that edit distance is used to quantifythe dissimilarity of two strings.This is done by counting the minimum number of operations requiredto 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 computesand returns their edit distance. Use a matrix (as in LCScalculations) to track results, and have the function print thematrix.
Compute edit distancebetween Bellman and empty string
Compute edit distancebetween test and test
Compute edit distancebetween mailman and namliam
Show each step of the process tochange mailman to namliam.This should verify the edit distance. You might find your solutionfrom part d (above) helpful.