def transform(dataset,
              split,
              transformation,
              train_data_path,
              test_data_path,
              output_path,
              prediction_path = None):
  """Applies all possible transformations by calling a parsing function."""
  if transformation not in [
      "none", "rir", "lird", "lird_rir", "lirind", "lirind_rir", "lird2",
      "lird_rir2", "lirind2", "lirind_rir2"
  ]:
    raise RuntimeError(
        "Transformation {} in not supported!".format(transformation))

  train_examples, test_examples, predictions = io_utils.load_data(
      train_data_path, test_data_path, prediction_path)
  parser = dataset_parser_utils.get_parser(dataset)(train_examples,
                                                    test_examples)

  if transformation == "none" or transformation == "lirind":
    train_examps_processed, test_examps_processed = parser.no_transformation()
  elif transformation == "rir" or transformation == "lirind_rir":
    train_examps_processed, test_examps_processed = parser.to_reversible()
  elif transformation == "lird":
    train_examps_processed, test_examps_processed = parser.program_to_lossy()
  elif transformation == "lird_rir":
    train_examps_processed, test_examps_processed = parser.rir_to_lossy()
  elif transformation == "lird2" or transformation == "lirind2":
    is_direct = True if transformation == "lird2" else False
    if not prediction_path:
      raise RuntimeError("No predictions file found!")
    train_examps_processed, test_examps_processed = parser.program_from_lossy(
        predictions, is_direct=is_direct)
  elif transformation == "lird_rir2" or transformation == "lirind_rir2":
    is_direct = True if transformation == "lird_rir2" else False
    if not prediction_path:
      raise RuntimeError("No predictions file found!")
    train_examps_processed, test_examps_processed = parser.rir_from_lossy(
        predictions, is_direct=is_direct)

  output_file = os.path.join(
      output_path, dataset + "_" + split + "_" + transformation + "_{}.tsv")
  io_utils.write_to_tsv(train_examps_processed, output_file.format("train"))
  io_utils.write_to_tsv(test_examps_processed, output_file.format("test"))
Applies all possible transformations by calling a parsing function.
language/compir/transform/apply_transformation_utils.py