code: def build_vocab(data):
      """Build vocabulary.
  
      Given the context in list format.
      Return the vocabulary, which is a dictionary for word to id.
      e.g. {'campbell': 2587, 'atlantic': 2247, 'aoun': 6746 .... }
  
      Parameters
      ----------
      data : list of str
          The context in list format
  
      Returns
      --------
      dictionary
          that maps word to unique ID. e.g. {'campbell': 2587, 'atlantic': 2247, 'aoun': 6746 .... }
  
      References
      ---------------
      - `tensorflow.models.rnn.ptb.reader <https://github.com/tensorflow/tensorflow/tree/master/tensorflow/models/rnn/ptb>`_
  
      Examples
      --------
      >>> data_path = os.getcwd() + '/simple-examples/data'
      >>> train_path = os.path.join(data_path, "ptb.train.txt")
      >>> word_to_id = build_vocab(read_txt_words(train_path))
  
      """
      # data = _read_words(filename)
      counter = collections.Counter(data)
      # tl.logging.info('counter %s' % counter)   # dictionary for the occurrence number of each word, e.g. 'banknote': 1, 'photography': 1, 'kia': 1
      count_pairs = sorted(counter.items(), key=lambda x: (-x[1], x[0]))
      # tl.logging.info('count_pairs %s' % count_pairs)  # convert dictionary to list of tuple, e.g. ('ssangyong', 1), ('swapo', 1), ('wachter', 1)
      words, _ = list(zip(*count_pairs))
      word_to_id = dict(zip(words, range(len(words))))
      # tl.logging.info(words)    # list of words
      # tl.logging.info(word_to_id) # dictionary for word to id, e.g. 'campbell': 2587, 'atlantic': 2247, 'aoun': 6746
      return word_to_id
  
imports: import collections
  import os
  import random
  import re
  import subprocess
  import tempfile
  import warnings
  from collections import Counter
  import numpy
  import six
  import tensorflow
  from six.moves import urllib, xrange
  from tensorflow.python.platform import gfile
  import tensorlayer
  from tensorlayer.lazy_imports import LazyImport
label_desc: Use image node_id 11 for calling a global function with example usage: build_vocab(data) and returns: word_to_id