pull/17/head
matthieugomez 2019-08-20 13:27:09 -04:00
parent c34bdc82dc
commit 728ac9b853
2 changed files with 4 additions and 4 deletions

View File

@ -91,13 +91,13 @@ The package includes distance "modifiers", that can be applied to any distance.
## Find (experimental)
`find_best` returns the best match in an iterator of AbstractStrings:
`find_best` returns the element of an iterator with the highest similarity score with a string
```julia
find_best("New York", ["NewYork", "Newark", "San Francisco"], Levenshtein())
#> "NewYork"
```
`find_all` returns a `Vector` with all the matches in an iterator of AbstractStrings:
`find_all` returns a collection of all the elements of an iterator with a similarity score higher than a minimum value (default to 0.8)
```julia
find_all("New York", ["NewYork", "Newark", "San Francisco"], Levenshtein(); min_score = 0.8)

View File

@ -1,7 +1,7 @@
"""
find_best(s1::AbstractString, iter, dist::PreMetric)
`find_best` returns the best element `iter` that has the best similarity score with `s1` according to the distance `dist`.
`find_best` returns the element of the iterator `iter` that has the highest similarity score with `s1` according to the distance `dist`.
The function is optimized for `Levenshtein` and `DamerauLevenshtein` distances (potentially modified by `Partial`, `TokenSort`, `TokenSet`, or `TokenMax`)
"""
function find_best(s1::AbstractString, iter_s2, dist::Union{T, Partial{T}, TokenSort{T}, TokenSet{T}, TokenMax{T}}) where T <: Union{Levenshtein, DamerauLevenshtein}
@ -32,7 +32,7 @@ end
"""
find_all(s1::AbstractString, iter, dist::PreMetric; min_score = 0.8)
`find_all` returns a vector with all the elements of `iter` that have a similarity score higher than 0.8 according to the distance `dist`.
`find_all` returns the vector with all the elements of `iter` that have a similarity score higher than `min_score` according to the distance `dist`.
The function is optimized for `Levenshtein` and `DamerauLevenshtein` distances (potentially modified by `Partial`, `TokenSort`, `TokenSet`, or `TokenMax`)
"""
function find_all(s1::AbstractString, iter_s2, dist::Union{T, Partial{T}, TokenSort{T}, TokenSet{T}, TokenMax{T}}; min_score = 0.8) where T <: Union{Levenshtein, DamerauLevenshtein}