Skip to content

weightedRatio

weightedRatio(a, b): number

Compute the weighted ratio between two strings.

Returns the highest of: the normalized Levenshtein similarity of the strings as given and after lower-casing and collapsing whitespace, tokenSortRatio, tokenSetRatio and partialRatio. Unlike WRatio in fuzzball / RapidFuzz, no score is scaled down or weighted by the length ratio of the strings, so scores are often higher than WRatio’s. Includes the cost of partialRatio (see there) when the strings differ in length. Returns a value between 0.0 and 1.0.

Parameter Type
a string
b string

number