Skip to content

Commit

Permalink
fixed compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyapuchka committed Jan 21, 2018
1 parent 763170d commit 6b7a632
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
}
Expand Down Expand Up @@ -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..<self.count {
// calculate v1 (current row distances) from the previous row v0
Expand All @@ -141,7 +141,7 @@ extension String {
current[0] = i + 1

// use formula to fill in the rest of the row
for j in 0..<target.count {
for j in 0..<target.characters.count {
current[j+1] = Swift.min(
last[j+1] + 1,
current[j] + 1,
Expand All @@ -153,7 +153,7 @@ extension String {
last = current
}

return current[target.count]
return current[target.characters.count]
}

}

0 comments on commit 6b7a632

Please sign in to comment.