Skip to content

Commit

Permalink
Update edit.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieugomez committed Jul 13, 2020
1 parent 3102922 commit 26221a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/edit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct Levenshtein <: Metric end
# Return max_value + 1 if distance higher than max_value
# This makes it possible to differentiate distance equalt to max_value vs strictly higher
# This is important for find_all
function (dist::Levenshtein)(s1, s2, max_value = nothing)
function (dist::Levenshtein)(s1, s2, max_value::Union{Integer, Nothing} = nothing)
((s1 === missing) | (s2 === missing)) && return missing
s1, s2 = reorder(s1, s2)
len1, len2 = length(s1), length(s2)
Expand Down Expand Up @@ -115,7 +115,7 @@ struct DamerauLevenshtein <: SemiMetric end

## http://blog.softwx.net/2015/01/optimizing-damerau-levenshtein_15.html
# Return max_value + 1 if distance higher than max_value
function (dist::DamerauLevenshtein)(s1, s2, max_value = nothing)
function (dist::DamerauLevenshtein)(s1, s2, max_value::Union{Integer, Nothing} = nothing)
((s1 === missing) | (s2 === missing)) && return missing
s1, s2 = reorder(s1, s2)
len1, len2 = length(s1), length(s2)
Expand Down

0 comments on commit 26221a1

Please sign in to comment.