code: def load_data(
      dest_dir="/tmp/.bigdl/dataset", nb_words=None, oov_char=2
  ):
      """Load IMDB dataset.
  
      :argument
          dest_dir: where to cache the data (relative to `~/.bigdl/dataset`).
          nb_words: number of words to keep, the words are already indexed by frequency
                    so that the less frequent words would be abandoned
          oov_char: index to pad the abandoned words, if None, one abandoned word
                    would be taken place with its next word and total length -= 1
      :return
          the train, test separated IMDB dataset.
      """
      path = download_imdb(dest_dir)
  
      with open(path, "rb") as f:
          (x_train, y_train), (x_test, y_test) = cPickle.load(f)
          # imdb.pkl would return different numbers of variables, not 4
  
      shuffle_by_seed([x_train, y_train, x_test, y_test])
      x = x_train + x_test
  
      if not nb_words:
          nb_words = max([max(s) for s in x])
  
      if oov_char is not None:
          new_x = []
          for s in x:
              new_s = []
              for word in s:
                  if word >= nb_words:
                      new_s.append(oov_char)
                  else:
                      new_s.append(word)
              new_x.append(new_s)
      else:
          new_x = []
          for s in x:
              new_s = []
              for word in s:
                  if word < nb_words:
                      new_s.append(word)
              new_x.append(new_s)
      x = new_x
  
      return (np.array(x[: len(x_train)]), np.array(y_train)), (
          np.array(x[len(x_train) :]),
          np.array(y_test),
      )
  
imports: from bigdl.dllib.feature.dataset import base
  import numpy
  from six.moves import cPickle
label_desc: Use image node_id 2 for calling a global function with example usage: load_data(dest_dir, nb_words, oov_char) and returns: np,  np,  np,  np