Skip to content

Fuzzy fuzz ratio

github-actions[bot] edited this page Aug 26, 2026 · 24 revisions

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

Fuzz.Ratio

Edit-distance similarity over the whole of both strings.

public static double Ratio(string a, string b)

Parametersa and b are the strings to compare. Order does not change the answer.

Returnsdouble in [0, 100]. 100 when identical, 0 when they share nothing.

Example — a transposition, and the two extremes.

using Lodestar.Fuzzy;

double typo = Fuzz.Ratio("apple pie", "appel pie");  // => 88.88888888888889
double same = Fuzz.Ratio("abc", "abc");  // => 100
double nothing = Fuzz.Ratio("abc", "xyz");  // => 0

Remarks — this is the scorer to reach for when the two strings are the same kind of thing: two spellings of a name, two renderings of an address. It compares everything, which is its strength and its limit.

Length is what breaks it. Fuzz.Ratio("apple", "an apple a day") is low, not because the strings disagree but because most of the second is absent from the first — and PartialRatio is the answer to that shape.

Applies to — net10.0, netstandard2.0.

See alsoFuzz.PartialRatio, Fuzz.TokenSortRatio.

Lodestar

Project

Clone this wiki locally