class_docstr: Vocab class.
  
  Parameters
  ----------
  lower_case : boolean
      Specify whether to lowercase text, default: ``True``.
  tokenizer: function, optional
      Word tokenization function, default: nltk.tokenize.word_tokenize.
  
  Examples
  -------
  >>> word_vocab = Vocab()
  >>> word_vocab.build_vocab({'i': 10, 'like': 5, 'nlp': 3})
  >>> print(word_vocab.get_vocab_size())
docstr: Trim vocab
code: def _trim(self, max_vocab_size=None, min_vocab_freq=1):
      """Trim vocab"""
      if min_vocab_freq <= 1 and (
          max_vocab_size is None
          or max_vocab_size >= len(self.word2index)
      ):
          return
  
      ordered_words = sorted(
          ((c, w) for (w, c) in self.word2count.items()), reverse=True
      )
  
      if max_vocab_size:
          ordered_words = ordered_words[:max_vocab_size]
  
      self.index2word = self.reserved[:]
      self.word2index = dict(
          zip(self.reserved, range(len(self.reserved)))
      )
      self.word2count = Counter()
  
      for count, word in ordered_words:
          if count < min_vocab_freq:
              break
          if word not in self.word2index:
              self.word2index[word] = len(self.index2word)
              self.word2count[word] = count
              self.index2word.append(word)
  
      assert len(self.word2index) == len(self.index2word)
  
imports: import os
  import pickle
  import re
  import warnings
  from collections import Counter
  from functools import lru_cache
  import numpy
  import torch
  from nltk.tokenize import word_tokenize
  from torchtext.vocab import GloVe, Vectors
  from .None import constants
label_desc: Use image node_id 4 for calling the Vocab obj's underlying member method code with example usage: obj._trim(max_vocab_size, min_vocab_freq) without return types