update result_type
parent
bffb80e8bd
commit
e0cc4f6bea
|
@ -42,6 +42,11 @@ include("qgram.jl")
|
|||
include("compare.jl")
|
||||
include("find.jl")
|
||||
|
||||
function result_type(m::Union{Hamming, Jaro, Levenshtein, DamerauLevenshtein, RatcliffObershelp, AbstractQGramDistance, Winkler, Partial, TokenSort, TokenSet, TokenMax}, a::AbstractString, b::AbstractString)
|
||||
typeof(evaluate(m, oneunit(a), oneunit(b)))
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
##############################################################################
|
||||
|
|
|
@ -276,10 +276,3 @@ function matching_blocks!(x::Set{Tuple{Int, Int, Int}}, s1::AbstractString, s2::
|
|||
matching_blocks!(x, s1after, s2after, len1 - (a[1] + a[3]) + 1, len2 - (a[2] + a[3]) + 1, start1 + a[1] + a[3] - 1, start2 + a[2] + a[3] - 1)
|
||||
return x
|
||||
end
|
||||
|
||||
const string_metrics = (Hamming, Jaro, Levenshtein, DamerauLevenshtein, RatcliffObershelp)
|
||||
const UnionStringMetrics = Union{string_metrics...}
|
||||
|
||||
function result_type(m::UnionStringMetrics, a::AbstractString, b::AbstractString)
|
||||
return typeof(evaluate(m, oneunit(a), oneunit(b)))
|
||||
end
|
||||
|
|
|
@ -290,7 +290,3 @@ function evaluate(dist::Overlap, count_dict)
|
|||
end
|
||||
1.0 - nintersect / min(ndistinct1, ndistinct2)
|
||||
end
|
||||
|
||||
# result types for QGram distances
|
||||
result_type(m::AbstractQGramDistance, a::AbstractString, b::AbstractString) =
|
||||
typeof(evaluate(m, oneunit(a), oneunit(b)))
|
||||
|
|
Loading…
Reference in New Issue