(query: string, topics: string[])
| 471 | } |
| 472 | |
| 473 | private calculateRelevance(query: string, topics: string[]): number { |
| 474 | const queryLower = query.toLowerCase(); |
| 475 | let score = 0; |
| 476 | |
| 477 | for (const topic of topics) { |
| 478 | if (queryLower.includes(topic.toLowerCase()) || topic.toLowerCase().includes(queryLower)) { |
| 479 | score += 1; |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | return score; |
| 484 | } |
| 485 | } |