You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is expected. Distances are defined for any iterators: in your example, the first argument is an iterator of Chars while the second argument is an iterator of Strings. They have no common elements so the distance between the two is the maximum length of the arguments.
What you want is to use . broadcasting:
using StringDistances
d =Levenshtein()
d.(Ref("minimal working example"), ["an array", " of strings"])
Alternatively, I also like to use comprehensions:
using StringDistances
d =Levenshtein()
[d("minimal working example", x) for x in ["an array", " of strings"]]
I'll leave the issue open in case other people get confused by this. If so, I may throw an error when eltype of each iterator is different.
Computing distances with one of the inputs as an array (of anything) does not result in an error, but instead gives a nonsensical result.
For example,
returns
23
, which is the length of the first argument, and not the distance between the first argument and any of the entries in the second argument.The result is identical (the length of the first argument, at least for Levenshtein) if the array is empty or contains non-string entries.
The text was updated successfully, but these errors were encountered: