-
Notifications
You must be signed in to change notification settings - Fork 0
Text indelpattern normalizedsimilarity
Development build. This page describes
main, not a released package. The latest published Lodestar.Text is 0.6.0 — read its documentation.
1 - NormalizedDistance, and — multiplied by 100 — exactly rapidfuzz's fuzz.ratio.
public double NormalizedSimilarity(ReadOnlySpan<char> text)Parameters — text is the string to scan against the pattern.
Returns — double in [0, 1], larger meaning more alike. Two empty inputs give 1.
Exceptions — ObjectDisposedException when the handle has been disposed.
Example — the ratio every candidate scores against one query.
using Lodestar.Text.Distances;
using IndelPattern query = IndelPattern.For("state");
double s = query.NormalizedSimilarity("taste".AsSpan()); // => 0.8Remarks — this is the member a bulk fuzz.ratio workload wants: multiply by 100 and the
numbers are rapidfuzz's, with the pattern's table built once instead of once per candidate.
Nothing here preprocesses. "Kitten" and "kitten" score below 1, exactly as
Indel.NormalizedSimilarity has them — normalize before building
the handle, once, rather than per text.
Applies to — net10.0, netstandard2.0.
See also — IndelPattern,
Indel.NormalizedSimilarity,
Fuzz.Ratio.