code: def dict_to_vocabs(vocabs_dict):
      """
      Convert a dict formatted vocabs (as stored in a checkpoint)
      into a dict of pyonmttok vocabs objects.
      """
      vocabs = {}
      vocabs["data_task"] = vocabs_dict["data_task"]
      if "decoder_start_token" in vocabs_dict.keys():
          vocabs["decoder_start_token"] = vocabs_dict[
              "decoder_start_token"
          ]
      else:
          vocabs["decoder_start_token"] = DefaultTokens.BOS
      vocabs["src"] = pyonmttok.build_vocab_from_tokens(
          vocabs_dict["src"]
      )
      if vocabs_dict["src"] == vocabs_dict["tgt"]:
          vocabs["tgt"] = vocabs["src"]
      else:
          vocabs["tgt"] = pyonmttok.build_vocab_from_tokens(
              vocabs_dict["tgt"]
          )
      if "src_feats" in vocabs_dict.keys():
          vocabs["src_feats"] = []
          for feat_vocab in vocabs_dict["src_feats"]:
              vocabs["src_feats"].append(
                  pyonmttok.build_vocab_from_tokens(feat_vocab)
              )
      return vocabs
  
file_path: OpenNMT-py/onmt/inputters/inputter.py
imports: import os
  from math import ceil
  import codecs
  import pyonmttok
  from onmt.constants import DefaultTokens
label_desc: Use image node_id 4 for calling a global function with example usage: dict_to_vocabs(vocabs_dict) and returns: vocabs