Fuzzy 0.4.0 extractresult - CyrilB1531/lodestar GitHub Wiki
Lodestar.Fuzzy 0.4.0. This page is frozen at that release. Read the current documentation for what
mainsays now. A link to a decision or a migration page followsmain, and leaves the archive.
ExtractResult
One candidate's choice, score and index.
public readonly record struct ExtractResult
Properties — Choice is the candidate string, Score its similarity in [0, 100], and
Index its position in the list that was searched.
Example — the best of several candidates, traced back to its row.
using Lodestar.Fuzzy;
string[] choices = ["apple pie", "apple tart", "banana bread", "cherry pie"];
ExtractResult? best = Process.ExtractOne("appel pie", choices);
string choice = best?.Choice; // => apple pie
int index = best?.Index ?? -1; // => 0
Remarks — Index is what makes the result usable. Candidates usually come from a list of
records rather than a list of strings, and the score alone cannot say which record matched —
matching the string back by value fails the moment two records share one.
A readonly record struct, so it is copied rather than referenced and compares by value.
Applies to — net10.0, netstandard2.0.
See also — Process.Extract,
Process.ExtractOne.