Levenshtein distance: Difference between revisions

m
m (→‎{{header|Action!}}: Noted the output appears not to match the program)
Line 418:
=={{header|ALGOL 68}}==
{{Trans|Action!}}
...largely to highlight the syntactic similarities.
<br>
Non-recursive algorithm - although Algol 68 supports recursion, Action! doesn't.
<lang algol68># Calculate Levenshtein distance between strings - translated from the Action! sample #
BEGIN
 
PROC damerau levenshtein distance = (STRING str1, str2)INT:
BEGIN
 
Line 455 ⟶ 457:
word 1 :="kitten"; word 2 := "sitting";
print((word 1," -> ",word 2,": "));
print(("Levenshtein Distance: ",whole(damerau levenshtein distance(word 1,word 2),0),newline));
word 1 := "rosettacode"; word 2 := "raisethysword";
print((word 1," -> ",word 2,": "));
print(("Levenshtein Distance: ",whole(damerau levenshtein distance(word 1,word 2),0),newline));
word 1 := "qwerty"; word 2 := "qweryt";
print((word 1," -> ",word 2,": "));
print(("Levenshtein Distance: ",whole(damerau levenshtein distance(word 1,word 2),0),newline));
 
word 1 := "Action!"; word 2 := "Algol 68";
print((word 1," -> ",word 2,": "));
print(("Levenshtein Distance: ",whole(damerau levenshtein distance(word 1,word 2),0),newline))
END</lang>
{{out}}
3,026

edits