{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package setsim\n\nPackage setsim holds set-similarity metrics shared by the layers that cluster text: preference clustering, mood's repetition detector, and lesson dedup.\n\nIt 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.\n\n## Functions\n\n```go\nfunc Jaccard[V any](a, b map[string]V) float64\n```\nJaccard is the intersection-over-union of two sets, in \\[0,1].\n\nThe 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.\n\nTwo 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.\n\n","path":"github.com/memcode-ai/memcode/internal/setsim","name":"setsim","synopsis":"Package setsim holds set-similarity metrics shared by the layers that cluster text: preference clustering, mood's repetition detector, and lesson dedup.","isRedistributable":true}
