code: def extract(self):
      os.makedirs(self.out_dir, exist_ok=True)
  
      word_count = Counter()
  
      texts = self.get_text()
      text_lengths = [None] * len(texts)
  
      for inx, text in enumerate(texts):
          words = tokenize(text)
          text_lengths[inx] = len(words)
          word_count.update(words)
  
      # UNK token will added on fly if you use Vocab class in core/text
      vocabulary = [
          w[0] for w in word_count.items() if w[1] >= self.min_freq
      ]
      vocabulary.sort()
  
      self.save_vocabulary(vocabulary)
  
      print("min text len=", min(text_lengths))
      print("max text len=", max(text_lengths))
  
file_path: mmf/tools/scripts/gqa/extract_vocabulary.py
imports: import argparse
  import json
  import os
  from collections import Counter
  from mmf.utils.text import tokenize
label_desc: Use image node_id 2 for calling the ExtractVocabulary obj's underlying member method code with example usage: obj.extract() without return types