def prune_vocab(vocab, min_reduce, trim_rule=None):
 result = 0
 old_len = len(vocab)
 for w in list(vocab):
  if (not keep_vocab_item(w, vocab[w], min_reduce, trim_rule)):
   result += vocab[w]
   del vocab[w]
 logger.info('pruned out %i tokens with count <=%i (before %i, after %i)', (old_len - len(vocab)), min_reduce, old_len, len(vocab))
 return result

def prune_vocab ( vocab , min_reduce , trim_rule = None ) : result = 0 old_len = len ( vocab ) for w in list ( vocab ) : if ( not keep_vocab_item ( w , vocab [ w ] , min_reduce , trim_rule ) ) : result += vocab [ w ] del vocab [ w ] logger . info ( 'pruned out %i tokens with count <=%i (before %i, after %i)' , ( old_len - len ( vocab ) ) , min_reduce , old_len , len ( vocab ) ) return result
remove all entries from the vocab dictionary with count smaller than min_reduce .