Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
feat: improve keyword detection
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed Jan 28, 2024
1 parent 23fb092 commit 63c3b41
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/add_course_images.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,23 @@ function extractKeywords(moduleName) {

// remove banned words
const bannedWords = [
"Semester", "Full", "Year",
"semester", "full", "year",
"and", "or", "the", "of", "in", "to", "for", "with", "on", "at", "from",
"First", "Second", "Third", "Fourth", "Fifth",
"I", "II", "III", "IV", "V",
"first", "second", "third", "fourth", "fifth",
"i", "ii", "iii", "iv", "v",
"-", "‐", "‒", "–", "—", "―", "−",
];
words = words.filter((word) => !bannedWords.includes(word));

if (words.length > 2) {
const bannedWords = [
"introduction", "foundations", "principles", "understanding",
];
words = words.filter((word) => !bannedWords.includes(word));
}

// limit to the first 4 words
words = words.slice(0, 4);
words = words.slice(0, 2);

return words.join(" ");
}
Expand Down

0 comments on commit 63c3b41

Please sign in to comment.