lev_token_sort_ratio {levitate} | R Documentation |
Ordered token matching
Description
Compares strings by tokenising them, sorting the tokens alphabetically and then computing the
lev_ratio()
of the result. This means that the order of words is irrelevant which can be
helpful in some circumstances.
Usage
lev_token_sort_ratio(a, b, pairwise = TRUE, useNames = TRUE, ...)
Arguments
a , b |
The input strings |
pairwise |
Boolean. If |
useNames |
Boolean. Use input vectors as row and column names? |
... |
Additional arguments to be passed to |
Value
A numeric scalar, vector or matrix depending on the length of the inputs.
See Also
Examples
x <- "Episode IV - Star Wars: A New Hope"
y <- "Star Wars Episode IV - New Hope"
# Because the order of words is different the simple approach gives a low match ratio.
lev_ratio(x, y)
# The sorted token approach ignores word order.
lev_token_sort_ratio(x, y)
[Package levitate version 0.2.0 Index]