AlexSSH

Untitled

Feb 17th, 2023 (edited)
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. const auto words = SplitIntoWordsNoStop(document);
  2. const double inv_word_count = 1 / static_cast<double>(words.size());
  3. set<string> s{words.begin(), words.end()};
  4. map<string_view, double> freqs;
  5. for (const auto &word: s) {
  6.     word_to_document_freqs_[word][document_id] += inv_word_count;
  7.     freqs[word] += inv_word_count;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment