Skip to content

Text 0.4.0 sorensendice

github-actions[bot] edited this page Aug 21, 2026 · 1 revision

Lodestar.Text 0.4.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

SorensenDice

Shared q-grams counted twice, over the two bag sizes added: 2·|A∩B| / (|A| + |B|).

public static class SorensenDice

Example — the same pair Jaccard scores, read on this scale.

using Lodestar.Text.Similarity;

double related = SorensenDice.Similarity("apple", "pineapple");  // => 0.7142…

Remarks — the same comparison as Jaccard, on a more forgiving scale. Dice = 2·Jaccard / (1 + Jaccard), which rises with Jaccard across the whole of [0, 1], so the two produce the same ranking and differ only in the number. Sorting candidates by one gives the order the other would; a threshold tuned against one has to be re-tuned for the other.

Reach for it when a human reads the score and Jaccard's numbers feel unduly harsh. It is Tversky with α = β = 0.5.

Applies to — net10.0, netstandard2.0.

See alsoJaccard, Tversky, the set-similarity index.

Members

Member What it does
SorensenDice.Similarity Shared grams counted twice, over both bag sizes.

Lodestar

Project

Clone this wiki locally