R.E.  Boss wrote:
> 
> What happens after 
> 
> 'levenshtein' Ldist 'malenstein'
> 
> or
> 
> 'levenshtein' Ldist1 'malenstein'
> 
> ?
> [...]
> 

I paste the answer from my terminal:
----------------------------
$ ~/j602/bin/jconsole 
   Ldist1=:>.&#`((>:@$:}:)~<.(>:@$:}:)<....@=&{:+$:&}:)@.(0<*&#)
   'levenshtein' Ldist1 'malenstein'
4
----------------------------
Since in your other post the claim was that the correct answer is 5,
I suppose we should figure out "where the truth lies" (coincidentally
I watched movie with this title earlier today).

Your program gives a diagram that is a 5-edit solution:


>   'levenshtein' Levdist 'malenstein'
> 5       NB. is the right answer
> 
>   p
> +---+-+---+-+--+-+-+-+
> |l  |e|ven|s|ht|e|i|n|
> +---+-+---+-+--+-+-+-+
> |mal|e|n  |s|t |e|i|n|
> +---+-+---+-+--+-+-+-+
> 

But there is also a 4 edits solution:

1. insert h:  malenstein -> malenshtein
2. substitute l with v:   -> mavenshtein
3. substitute a with e:  -> mevenshtein
4. substitute m with l:  -> levenshtein

This solution alone of course does not prove the optimality of 4.

-- 
View this message in context: 
http://www.nabble.com/Levenshtein-distance-tp23273653s24193p23288605.html
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to