class_docstr: Defines a vocabulary object that will be used to numericalize a field.
  
  Args:
      counter (~collections.Counter):
          :class:`~collections.Counter` object holding the frequencies of each value found in the data.
      min_freq (int):
          The minimum frequency needed to include a token in the vocabulary. Default: 1.
      specials (list[str]):
          The list of special tokens (e.g., pad, unk, bos and eos) that will be prepended to the vocabulary. Default: [].
      unk_index (int):
          The index of unk token. Default: 0.
  
  Attributes:
      itos:
          A list of token strings indexed by their numerical identifiers.
      stoi:
          A :class:`~collections.defaultdict` object mapping token strings to numerical identifiers.
code: def __init__(self, counter, min_freq=1, specials=[], unk_index=0):
      self.itos = list(specials)
      self.stoi = defaultdict(lambda: unk_index)
      self.stoi.update({token: i for i, token in enumerate(self.itos)})
      self.extend(
          [token for token, freq in counter.items() if freq >= min_freq]
      )
      self.unk_index = unk_index
      self.n_init = len(self)
  
file_path: underthesea/underthesea/utils/sp_vocab.py
imports: from collections import defaultdict
  from collections.abc import Iterable
label_desc: Use image node_id 1 to create a new Vocab object from inherited base classes: object with example: obj = Vocab(counter, min_freq, specials, unk_index)