fixed the remove-foreign-words script not to add extra words when used in whitelist mode
This commit is contained in:
parent
90288713f1
commit
a057e2a4e6
1 changed files with 3 additions and 3 deletions
|
|
@ -47,7 +47,7 @@ async function work({ isBlacklist, locale, fileName, foreignWordsLocale, foreign
|
||||||
|
|
||||||
let lineReader = createInterface({ input: createReadStream(fileName) });
|
let lineReader = createInterface({ input: createReadStream(fileName) });
|
||||||
for await (const line of lineReader) {
|
for await (const line of lineReader) {
|
||||||
originalWords.set(line.toLocaleLowerCase(foreignWordsLocale), line);
|
originalWords.set(line.toLocaleLowerCase(locale), line);
|
||||||
}
|
}
|
||||||
|
|
||||||
const goodWords = new Set();
|
const goodWords = new Set();
|
||||||
|
|
@ -58,14 +58,14 @@ async function work({ isBlacklist, locale, fileName, foreignWordsLocale, foreign
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wordKey = line.toLocaleLowerCase(locale);
|
const wordKey = line.toLocaleLowerCase(foreignWordsLocale);
|
||||||
|
|
||||||
if (isBlacklist && originalWords.has(wordKey)) {
|
if (isBlacklist && originalWords.has(wordKey)) {
|
||||||
originalWords.delete(wordKey);
|
originalWords.delete(wordKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isBlacklist && originalWords.has(wordKey)) {
|
if (!isBlacklist && originalWords.has(wordKey)) {
|
||||||
goodWords.add(line);
|
goodWords.add(originalWords.get(wordKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue