code: def pre_process_data(filepath):
      
      positive_path = os.path.join(filepath, 'pos')
      negative_path = os.path.join(filepath, 'neg')
  
      pos_label = 1
      neg_label = 0
  
      dataset = []
  
      for filename in glob.glob(os.path.join(positive_path, '*.txt')):
          with open(filename, 'r') as f:
              dataset.append((pos_label, f.read()))
  
      for filename in glob.glob(os.path.join(negative_path, '*.txt')):
          with open(filename, 'r') as f:
              dataset.append((neg_label, f.read()))
  
      shuffle(dataset)
  
      return dataset
docs: This is dependent on your training data source but we will try to generalize it as best as possible.