def create_task(task, context, delimiter_type,
                evidence_marker_type):
  """Creates a task w/ correct filenames and postprocessing."""

  # Fill in template fields that are common across train/dev/test.
  task_basename = "_".join([
      "wikidiff",
      task.name,
      context,
      delimiter_type.name,
      evidence_marker_type.name,
  ])
  filepath = functools.partial(
      FILEPATH_TEMPLATE.format,
      task=task.name,
      delimiter_type=delimiter_type.name,
      evidence_marker_type=evidence_marker_type.name,
  )
  register = functools.partial(
      _register_w_defaults,
      task=task,
      delimiter_type=delimiter_type,
  )

  # Create train task
  train_prefix = filepath(split="train", context=context)
  train_fnames = [f"{train_prefix}-0000{i}-of-00010" for i in range(9)]
  validation_fname = f"{train_prefix}-00009-of-00010"
  split_to_filepattern = {"train": train_fnames, "validation": validation_fname}
  register(task_basename, split_to_filepattern)

  # Create train (old) task
  train_old_prefix = filepath(split="train_old", context=context)
  train_old_fnames = [f"{train_old_prefix}-0000{i}-of-00010" for i in range(9)]
  validation_old_fname = f"{train_old_prefix}-00009-of-00010"
  split_to_filepattern = {
      "train": train_old_fnames,
      "validation": validation_old_fname
  }
  register(f"{task_basename}_old", split_to_filepattern)

  # Create (all evidence) evaluation tasks.
  dev_prefix = filepath(split="dev", context="all")
  dev_split_to_filepattern = {"test": f"{dev_prefix}-*"}
  register(f"{task_basename}_dev", dev_split_to_filepattern)

  test_prefix = filepath(split="test", context="all")
  test_split_to_filepattern = {"test": f"{test_prefix}-*"}
  register(f"{task_basename}_test", test_split_to_filepattern)

  # Create (oracle evidence) evaluation tasks.
  oracle_dev_prefix = filepath(split="dev", context="gold")
  oracle_dev_split_to_file_pattern = {"test": f"{oracle_dev_prefix}-*"}
  register(f"{task_basename}_oracle_dev", oracle_dev_split_to_file_pattern)

  oracle_test_prefix = filepath(split="test", context="gold")
  oracle_test_split_to_file_pattern = {"test": f"{oracle_test_prefix}-*"}
  register(f"{task_basename}_oracle_test", oracle_test_split_to_file_pattern)

  # Create gold test evaluation tasks.
  gold_test_prefix = filepath(split="gold_test", context="all")
  gold_test_split_to_file_pattern = {"test": gold_test_prefix}  # Only 1 file
  register(f"{task_basename}_gold_test", gold_test_split_to_file_pattern)

  oracle_gold_test_prefix = filepath(split="gold_test", context="gold")
  oracle_gold_test_split_to_file_pattern = {
      "test": oracle_gold_test_prefix
  }  # Only 1 file
  register(f"{task_basename}_oracle_gold_test",
           oracle_gold_test_split_to_file_pattern)
Creates a task w/ correct filenames and postprocessing.
language/fruit/tasks.py