|
@@ -1833,6 +1833,9 @@ levenshtein_distance :: proc(a, b: string, allocator := context.allocator) -> in
|
|
|
|
|
|
if n + 1 > len(LEVENSHTEIN_DEFAULT_COSTS) {
|
|
if n + 1 > len(LEVENSHTEIN_DEFAULT_COSTS) {
|
|
costs = make([]int, n + 1, allocator)
|
|
costs = make([]int, n + 1, allocator)
|
|
|
|
+ for k in 0..=n {
|
|
|
|
+ costs[k] = k
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
costs = LEVENSHTEIN_DEFAULT_COSTS
|
|
costs = LEVENSHTEIN_DEFAULT_COSTS
|
|
}
|
|
}
|
|
@@ -1841,10 +1844,6 @@ levenshtein_distance :: proc(a, b: string, allocator := context.allocator) -> in
|
|
delete(costs, allocator)
|
|
delete(costs, allocator)
|
|
}
|
|
}
|
|
|
|
|
|
- for k in 0..=n {
|
|
|
|
- costs[k] = k
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
i: int
|
|
i: int
|
|
for c1 in a {
|
|
for c1 in a {
|
|
costs[0] = i + 1
|
|
costs[0] = i + 1
|