def normalize(sentence_sets, word2id, max_sent_len):
  """Normalize the sentences by the following procedure
  - word to index 
  - add unk
  - pad/ cut the sentence length
  - record the sentence length

  Args: 
    sentence_sets: the set of sentence paraphrase, a list of sentence list
    word2id: word index, a dictionary
    max_sent_len: maximum sentence length, a integer
  """
  sent_sets = []
  sent_len_sets = []
  max_sent_len = max_sent_len + 1

  for st in sentence_sets:
    st_ = []
    st_len = []
    for s in st:
      s_ = [word2id["_GOO"]]
      for w in s:
        if(w in word2id): s_.append(word2id[w])
        else: s_.append(word2id["_UNK"])
      s_.append(word2id["_EOS"])
      
      s_ = s_[: max_sent_len]
      if(len(s_) < max_sent_len):
        s_len = len(s_) - 1
        for i in range(max_sent_len - len(s_)): s_.append(word2id["_PAD"])
      else: 
        s_[-1] = word2id["_EOS"]
        s_len = max_sent_len - 1

      st_.append(s_)
      st_len.append(s_len)
    
    sent_sets.append(st_)
    sent_len_sets.append(st_len)
  return sent_sets, sent_len_sets