Is this how auto-correct works?

Suppose we are given two strings aa and bb. We want to devise a function f(a,b)f(a,b) that tells us how close the two strings are. A reasonable measurement would be to measure how many "edits" operations have to be made to one string in order to change it to the other. There are three possible "edit" operations:

Substitution: Replacing a single character from aa so that it matches bb costs 11. If a=rota=\text{rot} and b=dotb=\text{dot}. Then f(a,b)=1f(a,b)=1.

Insertion: Inserting a single character also costs 11. Ie, If a=girla = \text{girl} and b=girlsb=\text{girls}, then f(a,b)=1f(a,b)=1.

Deletion: Deleting a single character also costs 11. Ie. If a=houra=\text{hour} and b=ourb=\text{our} then f(a,b)=1f(a,b)=1.

Given aa and bb, compute f(a,b)f(a,b).


Problem Loading...

Note Loading...

Set Loading...