code: def _create_ptb_vocabulary(data_dir):
      """Read the PTB sample data input to create vocabulary"""
      data_path = os.path.join(data_dir, "simple-examples/data/")
      file_name = "ptb.train.txt"
  
      def _read_words(filename):
          """Read the data for creating vocabulary"""
          with tf_compat_v1.gfile.GFile(filename, "r") as f:
              return (
                  f.read()
                  .encode("utf-8")
                  .decode("utf-8")
                  .replace("\n", "<eos>")
                  .split()
              )
  
      def _build_vocab(filename):
          """Create vocabulary"""
          data = _read_words(filename)
          counter = collections.Counter(data)
          count_pairs = sorted(
              counter.items(), key=lambda x: (-x[1], x[0])
          )
          words, _ = list(zip(*count_pairs))
          word_to_id = dict(zip(words, range(len(words))))
          # for python 3.x
          id_to_word = dict((v, k) for k, v in word_to_id.items())
          return word_to_id, id_to_word
  
      def ptb_raw_data(data_path, file_name):
          """Read the sample data and create vocabulary"""
          train_path = os.path.join(data_path, file_name)
          word_to_id, id_2_word = _build_vocab(train_path)
          return word_to_id, id_2_word
  
      return ptb_raw_data(data_path, file_name)
  
imports: import re
  import os.path
  import collections
  import numpy
  import tensorflow
  from tensorflow.core.framework import graph_pb2
  import tvm
  from tvm.contrib.download import download_testdata
label_desc: Use image node_id 10 for calling a global function with example usage: _create_ptb_vocabulary(data_dir) and returns: ptb_raw_data, word_to_id,  id_to_word, word_to_id,  id_2_word, f