Commit dfafe014 authored by Mathieu Valois's avatar Mathieu Valois
Browse files

distances

parent 123bbede
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

import sys
import random as rand
from time import time
import Levenshtein as leven

def rperm(l):
@@ -20,5 +21,18 @@ def cost(l):
		w0 = w
	return c

l = ["password", "linkedin", "passwOrd", "football123"]
print(cost(l))
 No newline at end of file
l = list()
filename = sys.argv[1]
a = time()
with open(filename) as inbuff:
	for word in inbuff:
		word = word.strip()
		l.append(word)
min_c = cost(l)
for i in range(19):
	before = time()
	c = cost(l)
	after = time()
	print(c, after-before)
	min_c = min(c, min_c)
print(min_c)
 No newline at end of file