code: def create_dicts(data):
      
      chars = set()
      for sample in data:
          chars.update(set(sample))
      char_indices = dict((c, i) for i, c in enumerate(chars))
      indices_char = dict((i, c) for i, c in enumerate(chars))
      return char_indices, indices_char
docs: Modified from Keras LSTM example