MCPcopy Create free account
hub / github.com/InferCore/InferCore / overlapScore

Function overlapScore

internal/retrieval/filekb.go:130–145  ·  view source on GitHub ↗
(q, doc []string)

Source from the content-addressed store, hash-verified

128}
129
130func overlapScore(q, doc []string) float64 {
131 set := make(map[string]struct{}, len(doc))
132 for _, t := range doc {
133 set[t] = struct{}{}
134 }
135 var hit float64
136 for _, t := range q {
137 if _, ok := set[t]; ok {
138 hit++
139 }
140 }
141 if hit == 0 {
142 return 0
143 }
144 return hit / float64(len(q))
145}

Callers 1

RetrieveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected