export function weightedScore(terms) { let total = 0; for (const [value, weight] of terms) total += value * weight; return total; }