Skip to content

Text indelpattern normalizedsimilarity

github-actions[bot] edited this page Sep 23, 2026 · 1 revision

Development build. This page describes main, not a released package. The latest published Lodestar.Text is 0.6.0 — read its documentation.

HomeTextDistances

IndelPattern.NormalizedSimilarity

1 - NormalizedDistance, and — multiplied by 100 — exactly rapidfuzz's fuzz.ratio.

public double NormalizedSimilarity(ReadOnlySpan<char> text)

Parameterstext is the string to scan against the pattern.

Returnsdouble in [0, 1], larger meaning more alike. Two empty inputs give 1.

ExceptionsObjectDisposedException 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.8

Remarks — 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 alsoIndelPattern, Indel.NormalizedSimilarity, Fuzz.Ratio.

Clone this wiki locally