Assuming these two strings:
string s1="control";
string s2="conrol"; (or "ocntrol", "onrtol", "lcontro" etc.)
How can I programatically find that s2 is similar with s1 and replace the s2 string with the s1 string?
Thanks.
Jeff
You could try to check the Levenshtein distance between your two words and if the distance is beyond a threshold, replace the word.
The hard part is defining the threshold, in your examples a threshold of 2 could work.
(Implementation of Levenshtein distance in C#)
You can use Levenshtein Distance which would give you a rank on how close the two words are. You need to decide at which rank you do the replace .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With