code: def get_idx2word(data_dir):
      idx2word = dict()
      with open(data_dir + "vocabulary", encoding="utf-8") as vc_f:
          for line in vc_f:
              pair = line.strip().split("\t")
              idx = int(pair[0].replace("idx_", ""))
              idx2word[idx] = pair[1]
  
      # add padding string to idx2word lookup
      idx2word[pad_idx] = pad_string
  
      return idx2word
  
file_path: singa/examples/qabot/qabot_data.py
imports: import numpy
  import random
  import os
  import urllib
label_desc: Use image node_id 4 for calling a global function with example usage: get_idx2word(data_dir) and returns: idx2word