code: def create_data(
      path,
      time_steps,
      t2i,
      vocab,
      lengths,
      split,
      s_num_short,
      num_train,
      num_valid,
      max_sentence,
  ):
      X = np.zeros((s_num_short, time_steps))  # init with <eos>
      with open(path, "r") as f:
          i_sent = 0
          idx = 0
          for ii, sentence in enumerate(f):
              if (split is "train" and ii < num_train) or (
                  split is "valid" and ii >= max_sentence - num_valid
              ):
                  sentence = (
                      sentence.lower().replace(".", "").replace(",", "")
                  )
                  sentence = sentence.replace("\xe2\x80\x99s", "")
                  token = sentence.split()
                  length = len(token)
                  if lengths[idx] <= time_steps:
                      trunc_len = min(length, time_steps)
                      for j in range(trunc_len):
                          j_prime = (
                              j + time_steps - trunc_len
                          )  # right-align sentences
                          # look up word index in vocab, 1 is <unk>  -- VERY SLOW!
                          X[i_sent, j_prime] = (
                              t2i[token[j]] if token[j] in vocab else 1
                          )
                      i_sent += 1
                  idx += 1
      return X
  
file_path: neon/examples/nmt/data.py
imports: import os
  import numpy
  from collections import Counter
  import h5py
  import tarfile
  import gzip
  from neon.data.datasets import Dataset
  from neon.util.argparser import NeonArgparser
label_desc: Use image node_id 5 for calling a global function with example usage: create_data(path, time_steps, t2i, vocab, lengths, split, s_num_short, num_train, num_valid, max_sentence) and returns: X