class_docstr: Builds and/or loads a dictionary.
  
  The dictionary provides access to the frequency of each token, functions to
  translate sentences from tokens to their vectors (list of ints, each int is the
  index of a token in the dictionary) and back from vectors to tokenized text.
class_docstr_tok: ["Builds","and\/or","loads","a","dictionary",".","The","dictionary","provides","access","to","the","frequency","of","each","token",",","functions","to","translate","sentences","from","tokens","to","their","vectors","(","list","of","ints",",","each","int","is","the","index","of","a","token","in","the","dictionary",")","and","back","from","vectors","to","tokenized","text","."]
docstr: Indicate what "kind" of tokenization is being done.
  
  This can be Training Time / Testing Time, and it can be over
  context or labels.
  
  This is used to signal from TorchAgent to the dict that it's allowed
  to enable things like BPE dropout. It is NOT used to indicate whether
  the dictionary itself is in training time.
  
  Use True for training time, False for not.
code: def set_tokenization_mode(self, mode: TokenizationMode):
      """
      Indicate what "kind" of tokenization is being done.
  
      This can be Training Time / Testing Time, and it can be over
      context or labels.
  
      This is used to signal from TorchAgent to the dict that it's allowed
      to enable things like BPE dropout. It is NOT used to indicate whether
      the dictionary itself is in training time.
  
      Use True for training time, False for not.
      """
      self._context_mode = mode
      if hasattr(self, "bpe"):
          # enable bpe dropout only in texts at training time. disable all
          # other times
          self.bpe.enable_bpe_dropout(
              mode == TokenizationMode.TRAIN_TIME_TEXT
          )
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.build_data import modelzoo_path
  from parlai.utils.bpe import bpe_factory, BPEHelper
  from .agents import Agent
  from .build_data import make_dir
  from collections import defaultdict
  import copy
  import numpy
  import os
  import json
  import re
  import parlai.utils.logging
  from parlai.utils.io import PathManager
  from typing import List
  import enum
label_desc: Use image node_id 37 for calling the DictionaryAgent obj's underlying member method code with example usage: obj.set_tokenization_mode(mode) without return types