def make_paired_annotations(
    gold_generation_fi: str, pred_generation_fi: str
) -> Iterator[PairedAnnotation]:
  """Reads annotations from files and match them based on the text.

  Args:
    gold_generation_fi: Path to the gold examples. This file should be provided.
    pred_generation_fi: Path to the model predicted examples. Format of this
      file can be found in the README.

  Yields:
    Each predicted + gold annotation pair.
  """
  gold_annos = _read_annotations(gold_generation_fi)
  pred_annos = _read_annotations(pred_generation_fi)
  for key, gold_anno in gold_annos.items():
    if key not in pred_annos:
      print(f"Gold annotation missing from predictions: {key}")
      continue
    pred_anno = pred_annos[key]
    yield PairedAnnotation(gold_anno, pred_anno)
Reads annotations from files and match them based on the text.

  Args:
    gold_generation_fi: Path to the gold examples. This file should be provided.
    pred_generation_fi: Path to the model predicted examples. Format of this
      file can be found in the README.

  Yields:
    Each predicted + gold annotation pair.
  
language/diffqg/annotation.py