class_docstr: Defines a vocabulary object that will be used to numericalize a field.
  
  Attributes:
      freqs: A collections.Counter object holding the frequencies of tokens
          in the data used to build the Vocab.
      stoi: A collections.defaultdict instance mapping token strings to
          numerical identifiers.
      itos: A list of token strings indexed by their numerical identifiers.
class_docstr_tok: ["Defines","a","vocabulary","object","that","will","be","used","to","numericalize","a","field",".","Attributes",":","freqs",":","A","collections.Counter","object","holding","the","frequencies","of","tokens","in","the","data","used","to","build","the","Vocab",".","stoi",":","A","collections.defaultdict","instance","mapping","token","strings","to","numerical","identifiers",".","itos",":","A","list","of","token","strings","indexed","by","their","numerical","identifiers","."]
docstr: Create a Vocab object from a collections.Counter.
  
  Arguments:
      counter: collections.Counter object holding the frequencies of
          each value found in the data.
      max_size: The maximum size of the vocabulary, or None for no
          maximum. Default: None.
      min_freq: The minimum frequency needed to include a token in the
          vocabulary. Values less than 1 will be set to 1. Default: 1.
      specials: The list of special tokens (e.g., padding or eos) that
          will be prepended to the vocabulary in addition to an <unk>
          token. Default: ['<pad>']
      vectors: One of either the available pretrained vectors
          or custom pretrained vectors (see Vocab.load_vectors);
          or a list of aforementioned vectors
docstr_tok: ["Create","a","Vocab","object","from","a","collections.Counter",".","Arguments",":","counter",":","collections.Counter","object","holding","the","frequencies","of","each","value","found","in","the","data",".","max_size",":","The","maximum","size","of","the","vocabulary",",","or","None","for","no","maximum",".","Default",":","None",".","min_freq",":","The","minimum","frequency","needed","to","include","a","token","in","the","vocabulary",".","Values","less","than","1","will","be","set","to","1",".","Default",":","1.","specials",":","The","list","of","special","tokens","(","e.g.",",","padding","or","eos",")","that","will","be","prepended","to","the","vocabulary","in","addition","to","an","<","unk",">","token",".","Default",":","[","'","<","pad",">","'","]","vectors",":","One","of","either","the","available","pretrained","vectors","or","custom","pretrained","vectors","(","see","Vocab.load_vectors",")",";","or","a","list","of","aforementioned","vectors"]
code: def __init__(
      self,
      counter,
      max_size=None,
      min_freq=1,
      specials=["<pad>"],
      vectors=None,
      cat_vectors=True,
  ):
      """Create a Vocab object from a collections.Counter.
  
      Arguments:
          counter: collections.Counter object holding the frequencies of
              each value found in the data.
          max_size: The maximum size of the vocabulary, or None for no
              maximum. Default: None.
          min_freq: The minimum frequency needed to include a token in the
              vocabulary. Values less than 1 will be set to 1. Default: 1.
          specials: The list of special tokens (e.g., padding or eos) that
              will be prepended to the vocabulary in addition to an <unk>
              token. Default: ['<pad>']
          vectors: One of either the available pretrained vectors
              or custom pretrained vectors (see Vocab.load_vectors);
              or a list of aforementioned vectors
      """
      self.freqs = counter
      counter = counter.copy()
      min_freq = max(min_freq, 1)
      counter.update(specials)
  
      self.stoi = defaultdict(_default_unk_index)
      self.stoi.update({tok: i for i, tok in enumerate(specials)})
      self.itos = list(specials)
  
      counter.subtract({tok: counter[tok] for tok in specials})
      max_size = None if max_size is None else max_size + len(self.itos)
  
      # sort by frequency, then alphabetically
      words_and_frequencies = sorted(
          counter.items(), key=lambda tup: tup[0]
      )
      words_and_frequencies.sort(key=lambda tup: tup[1], reverse=True)
  
      for word, freq in words_and_frequencies:
          if freq < min_freq or len(self.itos) == max_size:
              break
          self.itos.append(word)
          self.stoi[word] = len(self.itos) - 1
  
      self.vectors = None
      if vectors is not None:
          self.load_vectors(vectors, cat=cat_vectors)
  
imports: from __future__ import unicode_literals
  import array
  from collections import defaultdict
  import io
  import logging
  import os
  import zipfile
  import six
  from six.moves.urllib.request import urlretrieve
  import torch
  from tqdm import tqdm
  import tarfile
  from .utils import reporthook
label_desc: Use image node_id 1 to create a new Vocab object from inherited base classes: object with example: obj = Vocab(counter, max_size, min_freq, specials, vectors, cat_vectors)