(activeMonths: readonly string[])
| 111 | } |
| 112 | |
| 113 | export 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 | |
| 124 | export function computeFriendScore(components: FriendScoreComponents): ContactScoringResult { |
| 125 | const privateMessageScore = clamp01(components.privateMessageScore) |
no test coverage detected