Find the best lev_ratio() between substrings.

lev_partial_ratio(a, b, pairwise = TRUE, useNames = TRUE, ...)

Arguments

a, b

The input strings

pairwise

Boolean. If TRUE, only the pairwise distances between a and b will be computed, rather than the combinations of all elements.

useNames

Boolean. Use input vectors as row and column names?

...

Additional arguments to be passed to stringdist::stringdistmatrix() or stringdist::stringsimmatrix().

Value

A numeric scalar, vector or matrix depending on the length of the inputs.

Details

If string a has length len_a and is shorter than string b, this function finds the highest lev_ratio() of all the len_a-long substrings of b (and vice versa).

Examples

lev_ratio("Bruce Springsteen", "Bruce Springsteen and the E Street Band")
#> [1] 0.4358974

# Here the two "Bruce Springsteen" strings will match perfectly.
lev_partial_ratio("Bruce Springsteen", "Bruce Springsteen and the E Street Band")
#> [1] 1