code: def pad_data(
      path,
      vocab_size=20000,
      sentence_length=100,
      oov=2,
      start=1,
      index_from=3,
      seed=113,
      test_split=0.2,
  ):
      f = open(path, "rb")
      X, y = pickle.load(f)
      f.close()
  
      np.random.seed(seed)
      np.random.shuffle(X)
      np.random.seed(seed)
      np.random.shuffle(y)
  
      if start is not None:
          X = [[start] + [w + index_from for w in x] for x in X]
      else:
          X = [[w + index_from for w in x] for x in X]
  
      if not vocab_size:
          vocab_size = max([max(x) for x in X])
  
      # by convention, use 2 as OOV word
      # reserve 'index_from' (=3 by default) characters: 0 (padding), 1
      # (start), 2 (OOV)
      if oov is not None:
          X = [[oov if w >= vocab_size else w for w in x] for x in X]
  
      X_train = X[: int(len(X) * (1 - test_split))]
      y_train = y[: int(len(X) * (1 - test_split))]
  
      X_test = X[int(len(X) * (1 - test_split)) :]
      y_test = y[int(len(X) * (1 - test_split)) :]
  
      X_train = pad_sentences(X_train, sentence_length=sentence_length)
      y_train = np.array(y_train).reshape((len(y_train), 1))
  
      X_test = pad_sentences(X_test, sentence_length=sentence_length)
      y_test = np.array(y_test).reshape((len(y_test), 1))
  
      nclass = 1 + max(np.max(y_train), np.max(y_test))
  
      return (X_train, y_train), (X_test, y_test), nclass
  
file_path: neon/neon/data/text_preprocessing.py
imports: from future import standard_library
  from builtins import map
  import numpy
  import re
  from neon.util.compat import pickle
label_desc: Use image node_id 3 for calling a global function with example usage: pad_data(path, vocab_size, sentence_length, oov, start, index_from, seed, test_split) and returns: X_train,  y_train,  X_test,  y_test,  nclass