@@ -21,7 +21,6 @@ def compute_transform_tables(
2121 destination_seq = list (destination_string )
2222 len_source_seq = len (source_seq )
2323 len_destination_seq = len (destination_seq )
24-
2524 costs = [
2625 [0 for _ in range (len_destination_seq + 1 )] for _ in range (len_source_seq + 1 )
2726 ]
@@ -31,28 +30,28 @@ def compute_transform_tables(
3130
3231 for i in range (1 , len_source_seq + 1 ):
3332 costs [i ][0 ] = i * delete_cost
34- ops [i ][0 ] = f"D{ source_seq [i - 1 ]:c } "
33+ ops [i ][0 ] = f"D{ source_seq [i - 1 ]} "
3534
3635 for i in range (1 , len_destination_seq + 1 ):
3736 costs [0 ][i ] = i * insert_cost
38- ops [0 ][i ] = f"I{ destination_seq [i - 1 ]:c } "
37+ ops [0 ][i ] = f"I{ destination_seq [i - 1 ]} "
3938
4039 for i in range (1 , len_source_seq + 1 ):
4140 for j in range (1 , len_destination_seq + 1 ):
4241 if source_seq [i - 1 ] == destination_seq [j - 1 ]:
4342 costs [i ][j ] = costs [i - 1 ][j - 1 ] + copy_cost
44- ops [i ][j ] = f"C{ source_seq [i - 1 ]:c } "
43+ ops [i ][j ] = f"C{ source_seq [i - 1 ]} "
4544 else :
4645 costs [i ][j ] = costs [i - 1 ][j - 1 ] + replace_cost
47- ops [i ][j ] = f"R{ source_seq [i - 1 ]:c } " + str (destination_seq [j - 1 ])
46+ ops [i ][j ] = f"R{ source_seq [i - 1 ]} " + str (destination_seq [j - 1 ])
4847
4948 if costs [i - 1 ][j ] + delete_cost < costs [i ][j ]:
5049 costs [i ][j ] = costs [i - 1 ][j ] + delete_cost
51- ops [i ][j ] = f"D{ source_seq [i - 1 ]:c } "
50+ ops [i ][j ] = f"D{ source_seq [i - 1 ]} "
5251
5352 if costs [i ][j - 1 ] + insert_cost < costs [i ][j ]:
5453 costs [i ][j ] = costs [i ][j - 1 ] + insert_cost
55- ops [i ][j ] = f"I{ destination_seq [j - 1 ]:c } "
54+ ops [i ][j ] = f"I{ destination_seq [j - 1 ]} "
5655
5756 return costs , ops
5857
0 commit comments