Skip to content

Text jaccard

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.Text is 0.4.0 — read its documentation.

Jaccard

Shared q-grams over the grams either side holds at all: |A∩B| / |A∪B|.

public static class Jaccard

Example — a word against one that contains it.

using Lodestar.Text.Similarity;

double related = Jaccard.Similarity("apple", "pineapple");  // => 0.5555…

Remarks — the strictest of the five, and the usual default. Every gram either input holds alone lands in the denominator, so Jaccard is the one that notices a size gap most sharply: "apple" scores barely over a half against "pineapple" even though every one of its own grams is present.

It ranks identically to SorensenDice — the two are a monotone function of one another — so the choice between them is a choice of scale, not of order. It is also Tversky with α = β = 1.

Applies to — net10.0, netstandard2.0.

See alsoSorensenDice, Tversky, the set-similarity index.

Members

Member What it does
Jaccard.Similarity Shared grams over the union of both bags.

Lodestar

Project

Clone this wiki locally