Skip to content

sorensenDiceMany

sorensenDiceMany(reference, candidates, minSimilarity?): number[]

Compute the Sorensen-Dice coefficient from one reference string to many candidates.

Returns an array of similarity scores, one per candidate, in the same order as the input. If minSimilarity is provided, candidates scoring below the threshold return 0.0; a score equal to it is kept. Throws an InvalidArg error if minSimilarity is NaN. Reference bigrams are pre-computed once and reused for all candidates.

Parameter Type
reference string
candidates readonly string[]
minSimilarity? number | null

number[]