code: def read_imdb(
      path, split, shrink=1, fine_grained=False, char_based=False
  ):
      fg_label_dict = {
          "1": 0,
          "2": 0,
          "3": 1,
          "4": 1,
          "7": 2,
          "8": 2,
          "9": 3,
          "10": 3,
      }
  
      def read_and_label(posneg, label):
          dataset = []
          target = os.path.join(path, "aclImdb", split, posneg, "*")
          for i, f_path in enumerate(glob.glob(target)):
              if i % shrink != 0:
                  continue
              with io.open(
                  f_path, encoding="utf-8", errors="ignore"
              ) as f:
                  text = f.read().strip()
              tokens = split_text(normalize_text(text), char_based)
              if fine_grained:
                  # extract from f_path. e.g. /pos/200_8.txt -> 8
                  label = fg_label_dict[f_path.split("_")[-1][:-4]]
                  dataset.append((tokens, label))
              else:
                  dataset.append((tokens, label))
          return dataset
  
      pos_dataset = read_and_label("pos", 0)
      neg_dataset = read_and_label("neg", 1)
      return pos_dataset + neg_dataset
  
imports: import csv
  import glob
  import io
  import os
  import shutil
  import sys
  import tarfile
  import tempfile
  import numpy
  import chainer
  from nlp_utils import make_vocab
  from nlp_utils import normalize_text
  from nlp_utils import split_text
  from nlp_utils import transform_to_array
label_desc: Use image node_id 5 for calling a global function with example usage: read_imdb(path, split, shrink, fine_grained, char_based) and returns: unknown, dataset