Skip to content

normalizedHammingMany

normalizedHammingMany(reference, candidates, minSimilarity?): (number | null)[]

Compute the normalized Hamming similarity from one reference string to many candidates.

Returns an array of scores, one per candidate, in the same order as the input. Returns null for candidates with a different length than the reference. If minSimilarity is provided, candidates with similarity below the threshold will also return null; a score equal to it is kept. Throws an InvalidArg error if minSimilarity is NaN.

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

(number | null)[]