-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_tarea1_plantilla.py
36 lines (29 loc) · 1.23 KB
/
test_tarea1_plantilla.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import numpy as np
def dp_levenshtein_backwards(x, y):
return 0 # reemplazar/completar
def dp_restricted_damerau_backwards(x, y):
return 0 # reemplazar/completar
def dp_intermediate_damerau_backwards(x, y):
return 0 # reemplazar/completar
test = [("algoritmo","algortimo"),
("algoritmo","algortximo"),
("algoritmo","lagortimo"),
("algoritmo","agaloritom"),
("algoritmo","algormio"),
("acb","ba")]
for x,y in test:
print(f"{x:12} {y:12}",end="")
for dist,name in ((dp_levenshtein_backwards,"levenshtein"),
(dp_restricted_damerau_backwards,"restricted"),
(dp_intermediate_damerau_backwards,"intermediate")):
print(f" {name} {dist(x,y):2}",end="")
print()
"""
Salida del programa:
algoritmo algortimo levenshtein 2 restricted 1 intermediate 1
algoritmo algortximo levenshtein 3 restricted 3 intermediate 2
algoritmo lagortimo levenshtein 4 restricted 2 intermediate 2
algoritmo agaloritom levenshtein 5 restricted 4 intermediate 3
algoritmo algormio levenshtein 3 restricted 3 intermediate 2
acb ba levenshtein 3 restricted 3 intermediate 2
"""