code: def create_token_map(para, para_tokens):
      """
      Function to generate mapping between tokens and indices
      """
      token_map = {}
      char_append = ""
      para_token_idx = 0
      for char_idx, char in enumerate(para):
          if char != " ":
              current_para_token = para_tokens[para_token_idx]
              char_append += char
              if char_append == current_para_token:
                  token_map[char_idx - len(char_append) + 1] = [
                      char_append,
                      para_token_idx,
                  ]
                  para_token_idx += 1
                  char_append = ""
  
      return token_map
  
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 2 for calling a global function with example usage: create_token_map(para, para_tokens) and returns: token_map