Skip to content

Instantly share code, notes, and snippets.

View bailuobin's full-sized avatar

Luobin Bai bailuobin

View GitHub Profile
function termFreqMap(str) {
var words = str.split(' ');
var termFreq = {};
words.forEach(function(w) {
termFreq[w] = (termFreq[w] || 0) + 1;
});
return termFreq;
}
function addKeysToDict(map, dict) {