MCPcopy Create free account
hub / github.com/astercloud/aster / detectLowConfidence

Method detectLowConfidence

pkg/memory/quality_analyzer.go:203–224  ·  view source on GitHub ↗

detectLowConfidence 检测低置信度记忆

(memories []MemoryWithScore)

Source from the content-addressed store, hash-verified

201
202// detectLowConfidence 检测低置信度记忆
203func (qa *QualityAnalyzer) detectLowConfidence(memories []MemoryWithScore) []Inconsistency {
204 inconsistencies := []Inconsistency{}
205
206 for _, mem := range memories {
207 if mem.Provenance == nil {
208 continue
209 }
210
211 if mem.Provenance.Confidence < 0.4 {
212 inconsistencies = append(inconsistencies, Inconsistency{
213 Type: InconsistencyLowConfidence,
214 MemoryID1: mem.DocID,
215 Description: fmt.Sprintf("记忆置信度过低(%.2f):'%s'",
216 mem.Provenance.Confidence, truncate(mem.Text, 50)),
217 Severity: 1.0 - mem.Provenance.Confidence,
218 DetectedAt: time.Now(),
219 })
220 }
221 }
222
223 return inconsistencies
224}
225
226// calculateSimilarity 计算两个文本的相似度
227// 简化版:使用 Jaccard 相似度

Callers 2

TestDetectLowConfidenceFunction · 0.95
DetectInconsistenciesMethod · 0.95

Calls 1

truncateFunction · 0.70

Tested by 1

TestDetectLowConfidenceFunction · 0.76