the word normalization script now uses logarithmic scale instead of linear
This commit is contained in:
parent
d500980042
commit
e6e5908dbc
1 changed files with 2 additions and 2 deletions
|
|
@ -47,10 +47,10 @@ async function normalize({ fileName, maxAllowedFrequency }) {
|
|||
words.push({word, frequency});
|
||||
}
|
||||
|
||||
const normalizationRatio = maxAllowedFrequency / maxWordFrequency;
|
||||
const normalizationRatio = maxAllowedFrequency / Math.log(maxWordFrequency);
|
||||
|
||||
for (word of words) {
|
||||
word.frequency = Math.ceil(word.frequency * normalizationRatio);
|
||||
word.frequency = Math.ceil(Math.log(word.frequency) * normalizationRatio);
|
||||
}
|
||||
|
||||
return words;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue