class_docstr: Helper class for aggregating and building `Vocabulary` objects.
class_docstr_tok: ["Helper","class","for","aggregating","and","building","`","Vocabulary","`","objects","."]
docstr: Build a Vocabulary object from the values seen by the builder.
docstr_tok: ["Build","a","Vocabulary","object","from","the","values","seen","by","the","builder","."]
code: def make_vocab(self) -> Vocabulary:
      """Build a Vocabulary object from the values seen by the builder."""
      tokens_to_insert: List[Tuple[int, object]] = []
      if self.use_unk:
          tokens_to_insert.append((self.unk_index, self.unk_token))
          del self._counter[self.unk_token]
      if self.use_pad:
          tokens_to_insert.append((self.pad_index, self.pad_token))
          del self._counter[self.pad_token]
      if self.use_bos:
          tokens_to_insert.append((self.bos_index, self.bos_token))
          del self._counter[self.bos_token]
      if self.use_eos:
          tokens_to_insert.append((self.eos_index, self.eos_token))
          del self._counter[self.eos_token]
      if self.use_bol:
          tokens_to_insert.append((self.bol_index, SpecialTokens.BOL))
          del self._counter[SpecialTokens.BOL]
      if self.use_eol:
          tokens_to_insert.append((self.eol_index, SpecialTokens.EOL))
          del self._counter[SpecialTokens.EOL]
      if self.use_mask:
          tokens_to_insert.append((self.mask_index, SpecialTokens.MASK))
          del self._counter[SpecialTokens.MASK]
      vocab_list = list(self._counter)
      for index, token in sorted(tokens_to_insert):
          vocab_list.insert(index, token)
  
      return Vocabulary(
          vocab_list,
          counts=self._counter,
          unk_token=self.unk_token,
          pad_token=self.pad_token,
          bos_token=self.bos_token,
          eos_token=self.eos_token,
          mask_token=self.mask_token,
      )
  
imports: import itertools
  from collections import Counter
  from typing import Dict, List, Optional, Tuple
  import torch
  from pytext.common.constants import SpecialTokens, Token
  from pytext.utils import cuda, precision
label_desc: Use image node_id 6 for calling the VocabBuilder obj's underlying member method code with example usage: obj.make_vocab() and returns: Vocabulary