def process_tsv(src_file: str, tgt_file: str,
                affected_labels: Collection[str]) -> Tuple[int, int]:
  """Processes examples in the TSV file src_file and writes to tgt_file.

  Args:
    src_file: Source TSV file
    tgt_file: Target TSV file
    affected_labels: List of labels to detect. If an exemplar has any of these
      labels, add a guiding tag.

  Returns:
    (number of affected examples, total number of examples)
  """
  num_affected = num_total = 0
  with tf.io.gfile.GFile(src_file) as reader:
    with tf.io.gfile.GFile(tgt_file, "w") as writer:
      for line in reader:
        num_total += 1
        input_str, output_str = line.rstrip("\n").split("\t")
        exemplars = input_str.split(QUERY_EXEMPLARS_SEP, 1)[1]
        if any(x in exemplars for x in affected_labels):
          num_affected += 1
          input_str = input_str.replace(GUIDING_TAG_BEFORE, GUIDING_TAG_AFTER)
        writer.write("{}\t{}\n".format(input_str, output_str))
  return num_affected, num_total
Processes examples in the TSV file src_file and writes to tgt_file.

  Args:
    src_file: Source TSV file
    tgt_file: Target TSV file
    affected_labels: List of labels to detect. If an exemplar has any of these
      labels, add a guiding tag.

  Returns:
    (number of affected examples, total number of examples)
  
language/casper/augment/patch_guiding_tag.py