MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / computePrivateRegularity

Function computePrivateRegularity

packages/core/src/query/contact-scoring.ts:113–122  ·  view source on GitHub ↗
(activeMonths: readonly string[])

Source from the content-addressed store, hash-verified

111}
112
113export function computePrivateRegularity(activeMonths: readonly string[]): number {
114 const monthIndexes = getActiveMonthIndexes(activeMonths)
115 if (monthIndexes.length === 0) return 0
116
117 const activeCount = monthIndexes.length
118 const spanMonths = monthIndexes[monthIndexes.length - 1] - monthIndexes[0] + 1
119
120 // 定期性衡量持续规律:活跃月越多越高,跨度很大但只零星出现会被均匀度压低。
121 return activeCount * (activeCount / spanMonths)
122}
123
124export function computeFriendScore(components: FriendScoreComponents): ContactScoringResult {
125 const privateMessageScore = clamp01(components.privateMessageScore)

Callers 2

computeFriendScoresFunction · 0.85

Calls 1

getActiveMonthIndexesFunction · 0.85

Tested by

no test coverage detected