-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pairwise not working with StringDistances #45
Comments
The latest version of StringDistances is 0.10, and the problem does not appear with this version (reopen if not). |
Something weird going on here, I can manually add Version v0.10.0, but as soon as I do Anyway, I created a new Project to check this out and I can still reproduce the problem with versions v0.10.0 of StringDistances: (Test) pkg> add Distances, StringDistances
Updating registry at `~/.julia/registries/General`
Updating git-repo `git://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/Desktop/Test/Project.toml`
[b4f34e82] + Distances v0.10.0
[88034a9c] + StringDistances v0.10.0
Updating `~/Desktop/Test/Manifest.toml`
[b4f34e82] + Distances v0.10.0
[88034a9c] + StringDistances v0.10.0
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[9a3f8284] + Random
[9e88b42a] + Serialization
[2f01184e] + SparseArrays
[10745b16] + Statistics
julia> using Distances, StringDistances
julia> pairwise(Jaro(), ["hello" "world"])
ERROR: MethodError: result_type(::Jaro, ::Array{String,2}, ::Array{String,2}) is ambiguous. Candidates:
result_type(dist::PreMetric, a::AbstractArray, b::AbstractArray) in Distances at /home/simon/.julia/packages/Distances/d9gO5/src/generic.jl:36
result_type(dist::Union{Jaro, RatcliffObershelp, JaroWinkler, QGramDistance, DamerauLevenshtein, StringDistances.Hamming, Levenshtein, StringDistances.Normalized, Partial, TokenMax, TokenSet, TokenSort}, s1, s2) in StringDistances at /home/simon/.julia/packages/StringDistances/LqX4j/src/StringDistances.jl:14
Possible fix, define
result_type(::Union{Jaro, RatcliffObershelp, JaroWinkler, QGramDistance, DamerauLevenshtein, StringDistances.Hamming, Levenshtein, StringDistances.Normalized, Partial, TokenMax, TokenSet, TokenSort}, ::AbstractArray, ::AbstractArray)
Stacktrace:
[1] pairwise(::Jaro, ::Array{String,2}; dims::Nothing) at /home/simon/.julia/packages/Distances/d9gO5/src/generic.jl:212
[2] pairwise(::Jaro, ::Array{String,2}) at /home/simon/.julia/packages/Distances/d9gO5/src/generic.jl:209
[3] top-level scope at REPL[4]:1 |
Ok, it does not happen with the dev version of Distances. In any case, I think what you want to do is |
In the following example, the
pairwise
function fromDistances.jl
does not work.Versions:
* Julia: 1.5.1
* Distances: 0.9.2
* StringDistances: 0.8.0
I suspect that the reason for this ambiguity is making
StringDistance
a union, see #19The text was updated successfully, but these errors were encountered: