Update the word frequency object
170438
def _update_dictionary(self):
        
        self._total_words = sum(self._dictionary.values())
        self._unique_words = len(self._dictionary.keys())
        self._letters = set()
        for key in self._dictionary:
            self._letters.update(key)
831601
def set_frequency(self, frequency, rfm=1):
        
        cmds = {1: 'f', 2: 'F'}
        self._write_cmd('{}{}'.format(frequency, cmds[rfm]))
688546
function (s) {
            var c = clean( s );
            var all = _.words( c, wordDelimiter );
            var words = _(all).chain()
                    // remove stop words
                    .filter( function (w) {
                        return (stopWords.indexOf( w ) === -1) ;
                    })
                    // apply stemmer
                    .map( function (w) {
                        return stemmer( w );
                    })
                    // collect word frequencies
                    .reduce( function (collect, w) {
                        collect[w] = collect[w] ? collect[w] + 1 : 1 ;
                        return collect;
                    }, {}).value();
            // remove a word from this sentence to reduce redundancy in results
            var remove = function (w) {
                return delete words[w];
            };
            return {
                orig: s,
                words: words,
                remove: remove
            };
        }
1130042
def update(self, iteration, fobj):
        """""""
        self.bst.update(self.dtrain, iteration, fobj)
754194
def update(self, *args):
        ""
        for string in args:
            self._hobj.update(string)
        self._fobj = None
1141720
function updateWordCount() {
        var wordCount = document.getElementsByClassName('entry-word-count')[0],
            editorValue = editor.getValue();

        if (editorValue.length) {
            wordCount.innerHTML = editorValue.match(/\S+/g).length + ' words';
        }
    }
224479
def to_fasta(self):
        
        prefix, suffix = re.split('(?<=size=)\w+', self.label, maxsplit=1)
        new_count = int(round(self.frequency))
        new_label = "%s%d%s" % (prefix, new_count, suffix)
        return ">%s\n%s\n" % (new_label, self.sequence)
1030260
function updateWordCount (editor) {
    var word_count   = $('.entry-word-count');
    var editor_value = editor.getValue ();

    if (editor_value.length) {
      if (editor_value.match(/\S+/g) === null) {
        word_count.html ('0 words');
      } else {
        word_count.html (editor_value.match(/\S+/g).length + ' words');
      }
    }
  }
636025
def train(self, word_s):
        
        for word in word_s:
            # 把词语的每个前缀更新到 prefix_set 中
            for index in range(len(word)):
                self._set.add(word[:index + 1])
951852
def reset_frequencies(self, frequency=0):
        """"""

        frequency = max(frequency, 0)

        for key in self._store.keys():
            self._store[key] = (self._store[key][0], frequency)

        return frequency
1239590
private Map<String, AtomicInteger> frequency(List<Word> words){
        Map<String, AtomicInteger> frequency =new HashMap<>();
        words.forEach(word->{
            frequency.computeIfAbsent(word.getText(), k -> new AtomicInteger()).incrementAndGet();
        });
        return frequency;
    }
1299734
def calculate_term_frequencies(self):
		
		for doc in self.processed_corpus:
			term_frequency_doc = defaultdict(int)
			for word in doc:
				term_frequency_doc[word] += 1
			
			for key,value in term_frequency_doc.iteritems():
				term_frequency_doc[key] = (1.0 * value) / len(doc)
			self.term_frequencies.append(term_frequency_doc)
817341
def ensure_frequencies(self, frequencies):
        """"""
        if not frequencies:
            return {}
        if not isinstance(frequencies, dict):
            raise ValueError("frequencies should be dict")
        frequencies = {
            host: Frequency.ensure_frequency(frequencies[host]) for host in frequencies
        }
        return frequencies
749557
protected function updateWords()
    {
        try {
            $vocabulary = [];
            $allWords = $this->prepareWords();
            $this->addNewWords($allWords);
            $queryVocabulary = (new Query())->from(Vocabulary::tableName())->where(['word' => $allWords]);
            foreach ($queryVocabulary->each() as $vocabularyNew) {
                $vocabulary[$vocabularyNew['id']] = [$vocabularyNew['id'], $this->id];
            }
            if (!empty($vocabulary)) {
                if (!Podium::getInstance()->db->createCommand()->batchInsert(
                        '{{%podium_vocabulary_junction}}', ['word_id', 'post_id'], array_values($vocabulary)
                    )->execute()) {
                    throw new Exception('Words connections saving error!');
                }
            }
            $queryJunction = (new Query())->from('{{%podium_vocabulary_junction}}')->where(['post_id' => $this->id]);
            foreach ($queryJunction->each() as $junk) {
                if (!array_key_exists($junk['word_id'], $vocabulary)) {
                    if (!Podium::getInstance()->db->createCommand()->delete(
                            '{{%podium_vocabulary_junction}}', ['id' => $junk['id']]
                        )->execute()) {
                        throw new Exception('Words connections deleting error!');
                    }
                }
            }
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
            throw $e;
        }
    }
740505
function()
 {
   this.numTrainingExamples = 0;
   this.groupFrequencyCount = new Object();

   this.numWords = 0;
   this.wordFrequencyCount = new Object();
   this.groupWordTotal = new Object();
   this.groupWordFrequencyCount = new Object();
 }
952183
def term_frequency(document, term)
      tf = document.term_count(term)
      (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)
    end
1107395
def _compute_frequencies(self, word_sent):
    
    freq = defaultdict(int)
    for s in word_sent:
      for word in s:
        if word not in self._stopwords:
          freq[word] += 1
    # frequencies normalization and fitering
    m = float(max(freq.values()))
    for w in freq.keys():
      freq[w] = freq[w]/m
      if freq[w] >= self._max_cut or freq[w] <= self._min_cut:
        del freq[w]
    return freq