How do i grade the distance between 2 words
Wikipedia even has the (recursive) algorithm, right there for you to code.
yeah thats why i posted it
Check out the words library from ECraft2Learn.
This version exactly follows the definition of the Levenshtein distance (using some blocks from the “Words, sentences” library). It has one downside: it is a so-called naive recursive version, as it will calculate the same values over and over again while traversing the tree.
A solution to this is memoizing. I happen to have constructed an automatic memoizer some time ago, and applied it on this function just now. Using memoization, calculating Levenshtein distances is much faster.
That may be fast but produces incorrect results:
interesting. always was correct for me
You’re not the only one who discovered a bug in code that had previously appeared to work just fine … I found my automatic memoizer not to work with a slightly different version of the levenshtein
block (haven’t solved that yet, just circumvented it for now).