def string2index(sentences, vocab):
  """Convert string to its corresponding index
  i.e. A -> 0, B -> 1 ... for vocab [A,B,...]
  Args:
    sentences (np.array of String): list of String to convert.
     shape = [num_samples, length]
    vocab (list of String): list of vocabulary
  Returns:
      index (np.array of Integer): list of Integer after conversion
        shape = [num_samples, length]
  """
  alphabet_index = list(range(len(vocab)))
  mapping = dict(zip(vocab, alphabet_index))
  index = []
  for i in range(len(sentences)):
    sentence = []
    for j in range(len(sentences[i])):
      sentence.append(mapping[sentences[i, j]])
    index.append(sentence)
  return index