code: def preprocess(
      predicted_data, tokenizer, vocab, sequence_max_len=256
  ):
      """
      Convert the word str to word id and pad the text
      """
      result = []
      padding = vocab["<PAD>"]
      unknown = vocab["<UNK>"]
      for index, text in enumerate(predicted_data):
          data_arr = tokenizer.tokenize("".join(text.split()))
          wids = [
              vocab.get(w, unknown) for w in data_arr[:sequence_max_len]
          ]
          if len(wids) < sequence_max_len:
              wids = wids + [padding] * (sequence_max_len - len(wids))
  
          result_i = {"processed": []}
          result_i["origin"] = predicted_data[index]
          result_i["processed"] += wids
          result.append(result_i)
      return result
  
imports: import io
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: preprocess(predicted_data, tokenizer, vocab, sequence_max_len) and returns: result