Hi - I posted a question on here about this subject a while ago and atex pointed me in the direction of the pseudocode which helped alot.
From this I have created the following code, a program which is designed to ask users to input morse code using only ' ' , '.' and '-' then calculate the levenstein distance..
MyTable = array [0..Nocols, 0..Norows] of integer;
function Tdistance(s:string; t:string):integer;
if (n=0) then begin
if (m=0) then begin
for i := 0 to n do
d [i,0] := i;
for j :=0 to m do
d [j,0] := j;
for i:=1 to n do
for j:=1 to m do
if s[i]=t[j] then cost := 0
else cost := 1;
d[i,j] :=minimum (d[i-1,j] + 1, d[i, j-1] + 1, d[i-1,j-1] + cost);
writeln('Welcome to the minimum string edit distance program');
writeln('Please enter your first morse code string');
writeln('Please enter the second morse code string to have the MSE calculated');
So I have 2 questions...
1) As my programming is so rusty [color=Grey](bad)[/color].. i have forgotten how to display results (stored here as x). The result will be the number in the bottom right hand corner of the array as that is the minimum string edit distance.
2) I also need some help with the function 'minimun'. It needs to chose the option (delete, insert or substitute) which has the least 'cost'
Thanks for any help.
0 · ·