code: def create_vocabulary(data_list):
      """
      Function to generate vocabulary for both training and development datasets
      """
      vocab = {}
      for list_element in data_list:
          for sentence in list_element:
              for word in sentence:
                  if word in vocab:
                      vocab[word] += 1
                  else:
                      vocab[word] = 1
  
      _vocab_list = START_VOCAB + sorted(
          vocab, key=vocab.get, reverse=True
      )
      _vocab_dict = dict(
          (vocab_ele, i) for i, vocab_ele in enumerate(_vocab_list)
      )
  
      return _vocab_list, _vocab_dict
  
file_path: nlp-architect/examples/reading_comprehension/match_lstm_mrc/prepare_data.py
imports: from __future__ import print_function
  import numpy
  import argparse
  import json
  import os
  from tqdm import tqdm
  from nlp_architect.utils.io import validate_existing_directory
  from nlp_architect.utils.text import SpacyInstance
label_desc: Use image node_id 1 for calling a global function with example usage: create_vocabulary(data_list) and returns: _vocab_list,  _vocab_dict