Fuzzy 0.4.0 fuzz tokensortratio - CyrilB1531/lodestar GitHub Wiki

Lodestar.Fuzzy 0.4.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

Fuzz.TokenSortRatio

The words sorted before comparing, so their order stops counting.

public static double TokenSortRatio(string a, string b)

Parametersa and b are the strings to compare.

Returnsdouble in [0, 100], the Ratio of the two strings after each is split into words, sorted and rejoined.

Example — the same words in a different order.

using Lodestar.Fuzzy;

double reordered = Fuzz.TokenSortRatio("new york mets", "mets new york");  // => 100

Remarks100, where Ratio on the same pair is much lower. Word order is the difference, and for names, addresses and titles it usually carries no meaning — "Smith, John" and "John Smith" are one person.

It still counts extra words against you: a side with a word the other lacks scores lower, which is the difference from TokenSetRatio.

Applies to — net10.0, netstandard2.0.

See alsoFuzz.TokenSetRatio, Fuzz.Ratio.