Problem 848. Calculate a modified Levenshtein distance between two strings
Solution Stats
Problem Comments
-
3 Comments
Question on Test Suite #2.
s1 = 'Which words need to be edited?';
s2 = 'Can you tell which words need to be edited?';
d_correct = 3;
I see this as a 2, Substitute w for W and insert 'Can you tell ' - done. Where is the 3rd change?
Richard - you do not have to substitute w for W (words are case-insensitive). And inserting 'Can you tell' is three edits, one for each word.
I understand how this problem was designed, but I disagree. For instance transforming s1 = 'I do not like MATLAB' into s2 = 'I love MATLAB a lot' should be a 2-word edit, because the 3-words 'do not like' could be grouped into 1-word and changed into 'love', as well as 'a lot' could be treated as just 1-word insertion after the word MATLAB. And that's probably how the original Leveshtein distance would measure it, since the algorithm returns 15-character edits: transforming 'do not like' into 'love' requires 9-character edits, and inserting ' a lot' after 'MATLAB' requires 6-character edits.
Solution Comments
Show commentsProblem Recent Solvers121
Suggested Problems
-
Back to basics 6 - Column Vector
1068 Solvers
-
Number of 1s in a binary string
9337 Solvers
-
Cell Counting: How Many Draws?
2074 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
222 Solvers
-
Create an n-by-n null matrix and fill with ones certain positions
614 Solvers
More from this Author44
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!