Documentation
¶
Overview ¶
Package setsim holds set-similarity metrics shared by the layers that cluster text: preference clustering, mood's repetition detector, and lesson dedup.
It exists because the same function had been written three times, in two map shapes, and had already started to diverge — one copy had dropped a guard the others kept. A similarity metric that decides whether two things are "the same" is exactly the kind of code that should have one definition and one set of tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Jaccard ¶
Jaccard is the intersection-over-union of two sets, in [0,1].
The value type is free so callers can keep whichever map shape they already use — map[string]bool and map[string]struct{} are both idiomatic set spellings and neither should have to convert to share this.
Two empty sets score 0, not 1: callers use this to ask "is this new thing a repeat of that one", and an empty token set carries no evidence either way. Scoring it as a perfect match would make every content-free input look like a duplicate of every other.
Types ¶
This section is empty.