...
|
...
|
@@ -110,6 +110,9 @@ if [[ $nouveau = @(check|prox|leven) ]]; then
|
110
|
110
|
progress = 0
|
111
|
111
|
found_words = 0
|
112
|
112
|
|
|
113
|
+ cost_tot = cost_ins + cost_del + cost_rep
|
|
114
|
+ cost_tot = cost_tot > cost_max ? cost_max : cost_tot
|
|
115
|
+
|
113
|
116
|
str1_len = length(ancien)
|
114
|
117
|
for (i=1; i<=str1_len; i++)
|
115
|
118
|
str1_substr[i]=substr(ancien, i, 1)
|
...
|
...
|
@@ -137,8 +140,9 @@ if [[ $nouveau = @(check|prox|leven) ]]; then
|
137
|
140
|
for (word=1; word<=NF; word++) {
|
138
|
141
|
progress++
|
139
|
142
|
lvstn = levenshtein(gensub("[[:punct:]]","","g",$word))
|
140
|
|
- if (lvstn <= 3 && lvstn > 0) {
|
141
|
|
- approx_possibles[$word]++
|
|
143
|
+ if (lvstn <= cost_tot && lvstn > 0) {
|
|
144
|
+ key = sprintf("%s (%d)", $word, lvstn)
|
|
145
|
+ approx_possibles[key]++
|
142
|
146
|
found_words++
|
143
|
147
|
}
|
144
|
148
|
pct_progress=int(progress / wc * 100)
|