(texts: string[], cap = 8)
| 63 | |
| 64 | /** Terms (surface forms) whose stem appears in EVERY text — the stable core of the approach. PURE. */ |
| 65 | export function commonCore(texts: string[], cap = 8): string[] { |
| 66 | if (!texts.length) return []; |
| 67 | const maps = texts.map(surfaceByStem); |
| 68 | const out: string[] = []; |
| 69 | for (const [s, w] of maps[0]!) { |
| 70 | if (maps.every(m => m.has(s))) out.push(w); |
| 71 | if (out.length >= cap) break; |
| 72 | } |
| 73 | return out; |
| 74 | } |
| 75 | |
| 76 | const isMultiline = (t: string): boolean => t.split('\n').filter(l => l.trim()).length >= 3; |
| 77 |
no test coverage detected