The search string to score cached titles against.
Corpus source, supplier filter, scorer subset, minScore, rows,
and whether to print.
The full scored result, also printed unless print: false.
// In the console:
const result = await chempal.fuzzTest("sodium borohydride");
// ┌─────────┬───────┬──────────────────────────────┬────────────┐
// │ (index) │ score │ title │ supplier │
// ├─────────┼───────┼──────────────────────────────┼────────────┤
// │ 0 │ 100 │ 'Sodium Borohydride 98%' │ 'Loudwolf' │
// └─────────┴───────┴──────────────────────────────┴────────────┘
result.spread[0]; // the title the scorers disagree on most
await chempal.fuzzTest("acetone", { supplier: "Loudwolf", rows: 25 });
export async function fuzzTest(
query: string,
options: FuzzProbeOptions = {},
): Promise<FuzzProbeResult> {
const corpus = await collectCachedTitles(options.source);
const result = scoreCorpus(query, corpus, options);
if (options.print !== false) {
printFuzzProbe(result, options.limit);
}
return result;
}
Runs a query against every cached product title with all nine fuzz scorers and prints them side by side — the offline equivalent of
SupplierBase.fuzzyFilter's dev-only comparison table, but over the whole local cache and with no search.