code: def from_corpus(corpus, size, remove_singleton=True):
      vocab_entry = VocabEntry()
  
      word_freq = Counter(chain(*corpus))
      non_singletons = [w for w in word_freq if word_freq[w] > 1]
      print(
          "number of word types: %d, number of word types w/ frequency > 1: %d"
          % (len(word_freq), len(non_singletons))
      )
  
      top_k_words = sorted(
          word_freq.keys(), reverse=True, key=word_freq.get
      )[:size]
  
      for word in top_k_words:
          if len(vocab_entry) < size:
              if not (word_freq[word] == 1 and remove_singleton):
                  vocab_entry.add(word)
  
      return vocab_entry
  
imports: import argparse
  from collections import Counter
  from itertools import chain
  import torch
  from util import read_corpus
label_desc: Use image node_id 9 for calling the VocabEntry obj's underlying member method code with example usage: obj.from_corpus(corpus, size, remove_singleton) and returns: vocab_entry