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: Convert a vector of IDs to a string.
  
  Converts a vector (iterable of ints) into a string, with each token separated by
  the delimiter (default ``' '``).
code: def vec2txt(self, vector, delimiter=" "):
      """
      Convert a vector of IDs to a string.
  
      Converts a vector (iterable of ints) into a string, with each token separated by
      the delimiter (default ``' '``).
      """
      tokens = [self[int(idx)] for idx in vector]
      if self.tokenizer in ["gpt2", "bpe", "slow_bytelevel_bpe"]:
          # if we used a BPE tokenizer we need to rejoin the encodings
          text = self.bpe.decode(tokens, vector, delimiter)
      elif self.tokenizer == "bytelevelbpe":
          # We add special tokens in the beginning of ParlAI dict but in the
          # end of Hugging Face dict, there is an offset of #(extra tokens) between them.
          extra_tokens = 4  # length of special tokens
          vector = [
              self.bpe.special_tok_map[int(idx)]
              if int(idx) in self.bpe.special_tok_map
              else int(idx) - extra_tokens
              for idx in vector
          ]
          tokens = [self[int(idx)] for idx in vector]
          text = self.bpe.decode(tokens, vector, delimiter)
      else:
          text = delimiter.join(self[int(idx)] for idx in vector)
  
      return 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 32 for calling the DictionaryAgent obj's underlying member method code with example usage: obj.vec2txt(vector, delimiter) and returns: text