1
0
Fork 0

dictionary frequency normalization script

This commit is contained in:
sspanak 2024-04-08 19:14:29 +03:00 committed by Dimo Karaivanov
parent 671df5288c
commit 1e35e35d77
3 changed files with 77 additions and 15 deletions

View file

@ -3,5 +3,11 @@ exports.print = function(str) {
};
exports.printError = function(str) {
process.stderr.write(`${str}\n`);
};
process.stderr.write(`${str instanceof Error ? str.stack : str}\n`);
};
exports.printWordsWithFrequencies = function(words) {
if (Array.isArray(words)) {
words.forEach(w => exports.print(`${w.word}${w.frequency ? '\t' + w.frequency : ''}`));
}
}