MCPcopy
hub / github.com/ananthakumaran/paisa / loadVectorCache

Function loadVectorCache

internal/prediction/tf_idf.go:31–41  ·  view source on GitHub ↗
(db *gorm.DB)

Source from the content-addressed store, hash-verified

29var cache tfidfCache
30
31func loadVectorCache(db *gorm.DB) {
32 postings := query.Init(db).All()
33 idx := buldIndex(postings)
34
35 cache.index = idx
36 cache.vector = make(map[string]map[string]float64)
37
38 for account := range idx.Docs {
39 cache.vector[account] = tfidf(account, idx)
40 }
41}
42
43func ClearCache() {
44 cache = tfidfCache{}

Callers 1

GetTfIdfFunction · 0.85

Calls 4

InitFunction · 0.92
buldIndexFunction · 0.85
AllMethod · 0.80
tfidfFunction · 0.70

Tested by

no test coverage detected