Big commit for py3

This commit is contained in:
jar3b
2016-04-22 14:30:05 +03:00
parent 9ed372857e
commit c7f0de74a5
15 changed files with 103 additions and 63 deletions

View File

@@ -13,7 +13,7 @@ def violet_ratio(pattern, candidate):
for i in range(len(arr_pattern) - 1, -1, -1):
max_j = -1
max_ratio = -1
allowed_nums = range(len(arr_candidate) - 1, -1, -1)
allowed_nums = list(range(len(arr_candidate) - 1, -1, -1))
for j in allowed_nums:
ratio = Levenshtein.ratio(arr_pattern[i], arr_candidate[j])
@@ -24,7 +24,7 @@ def violet_ratio(pattern, candidate):
result.append(max_j*abs(max_ratio))
if max_j > -1:
allowed_nums.remove(max_j)
del allowed_nums[max_j]
del arr_candidate[max_j]
return sum(result) - len(arr_candidate)