(counts: Map<string, number>, word: string, weight = 1)
| 178 | } |
| 179 | |
| 180 | function addWord(counts: Map<string, number>, word: string, weight = 1): void { |
| 181 | const normalized = word.trim().toLowerCase(); |
| 182 | if (!isUsefulWord(normalized)) return; |
| 183 | counts.set(normalized, (counts.get(normalized) || 0) + weight); |
| 184 | } |
| 185 | |
| 186 | function pruneOverlappingWords(entries: Array<[string, number]>): Array<[string, number]> { |
| 187 | return entries.filter(([word, count]) => { |
no test coverage detected