wordFrequencyProbability function
Word probability calculation - Word Frequency
.
This function is used to calculate the probability of a word to be the main topic (important score) Could be used to calculate Term Frequency - document exclusive
Implementation
Map<String, double> wordFrequencyProbability(TokenizationOutput tokenOut) {
Map<String, double> wordsProbability = {};
tokenOut.bagOfWords.forEach((key, val) {
wordsProbability[key] = val / tokenOut.totalNumberOfWords;
});
return wordsProbability;
}