import from StatsAPI
parent
2dd75ae6fa
commit
f26cd16983
|
@ -4,10 +4,12 @@ version = "0.10.0"
|
|||
|
||||
[deps]
|
||||
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
|
||||
StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
|
||||
|
||||
[compat]
|
||||
Distances = "0.8.1, 0.9, 0.10"
|
||||
julia = "1.3"
|
||||
StatsAPI = "1"
|
||||
|
||||
[extras]
|
||||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module StringDistances
|
||||
|
||||
using Distances
|
||||
import StatsAPI: pairwise, pairwise!
|
||||
|
||||
include("distances/utils.jl")
|
||||
include("distances/edit.jl")
|
||||
|
|
|
@ -25,9 +25,7 @@ julia> pairwise(Levenshtein(), iter, iter2)
|
|||
10.0
|
||||
```
|
||||
"""
|
||||
Distances.pairwise
|
||||
|
||||
function Distances.pairwise(dist::StringDistance, xs::AbstractVector, ys::AbstractVector = xs; preprocess = nothing)
|
||||
function pairwise(dist::StringDistance, xs::AbstractVector, ys::AbstractVector = xs; preprocess = nothing)
|
||||
T = result_type(dist, eltype(xs), eltype(ys))
|
||||
if Missing <: Union{eltype(xs), eltype(ys)}
|
||||
T = Union{T, Missing}
|
||||
|
@ -46,9 +44,7 @@ For AbstractQGramDistances preprocessing will be used either if `preprocess` is
|
|||
to true or if there are more than 5 elements in `xs`. Set `preprocess` to
|
||||
false if no preprocessing should be used, regardless of length.
|
||||
"""
|
||||
Distances.pairwise!
|
||||
|
||||
function Distances.pairwise!(R::AbstractMatrix, dist::StringDistance, xs::AbstractVector, ys::AbstractVector = xs; preprocess = nothing)
|
||||
function pairwise!(R::AbstractMatrix, dist::StringDistance, xs::AbstractVector, ys::AbstractVector = xs; preprocess = nothing)
|
||||
length(xs) == size(R, 1) || throw(DimensionMismatch("inconsistent length"))
|
||||
length(ys) == size(R, 2) || throw(DimensionMismatch("inconsistent length"))
|
||||
((xs === ys) & (dist isa SemiMetric)) ?
|
||||
|
|
Loading…
Reference in New Issue