diff --git a/Sources/Parser.swift b/Sources/Parser.swift index 63210667..60a0101e 100644 --- a/Sources/Parser.swift +++ b/Sources/Parser.swift @@ -102,7 +102,7 @@ public class TokenParser { let filtersWithDistance = allFilters .map({ (filterName: $0, distance: $0.levenshteinDistance(name)) }) // do not suggest filters which names are shorter than the distance - .filter({ $0.filterName.count > $0.distance }) + .filter({ $0.filterName.characters.count > $0.distance }) guard let minDistance = filtersWithDistance.min(by: { $0.distance < $1.distance })?.distance else { return [] } @@ -130,8 +130,8 @@ extension String { // initialize v0 (the previous row of distances) // this row is A[0][i]: edit distance for an empty s // the distance is just the number of characters to delete from t - last = [Int](0...target.count) - current = [Int](repeating: 0, count: target.count + 1) + last = [Int](0...target.characters.count) + current = [Int](repeating: 0, count: target.characters.count + 1) for i in 0..