Levenshtein distance/Alignment: Difference between revisions
Content deleted Content added
m →Racket: Complete version: Use argmin |
m Made Racket sub-sections appear as sub-sections |
||
Line 269: | Line 269: | ||
=={{header|Racket}}== |
=={{header|Racket}}== |
||
==Simple version (no aligment)== |
===Simple version (no aligment)=== |
||
First we will analyze this solution that only computes the distance. |
First we will analyze this solution that only computes the distance. |
||
See http://blog.racket-lang.org/2012/08/dynamic-programming-versus-memoization.html |
See http://blog.racket-lang.org/2012/08/dynamic-programming-versus-memoization.html |
||
Line 300: | Line 300: | ||
<pre>8</pre> |
<pre>8</pre> |
||
==Complete version== |
===Complete version=== |
||
Now we extend the code from http://blog.racket-lang.org/2012/08/dynamic-programming-versus-memoization.html to show also the alignment. The code is very similar, but it stores the partial results (number of edits and alignment of each substring) in a lev structure. |
Now we extend the code from http://blog.racket-lang.org/2012/08/dynamic-programming-versus-memoization.html to show also the alignment. The code is very similar, but it stores the partial results (number of edits and alignment of each substring) in a lev structure. |
||
<lang Racket>#lang racket |
<lang Racket>#lang racket |