def _read_annotations(diffqg_fi: str) -> Dict[str, Annotation]:
  """Reads annotations from a file in either the gold or predicted format.

  Args:
    diffqg_fi: Path to the input file.

  Returns:
    Dictionary mapping a unique string identifier of the annotation to an
      Annotation object.
  """
  with open(diffqg_fi, "rt") as fr:
    json_dics = [json.loads(s) for s in fr.readlines()]
  print(f"Read {len(json_dics)} jsons from {diffqg_fi}")
  overall_dic = {}

  for json_dic in json_dics:
    anno = Annotation(json_dic)
    key = anno.key_annotation()
    if key in overall_dic:
      print(f"Possible repeated annotation for {key}")
      if anno.question != overall_dic[key].question:
        print("Error! Different questions.")
        print(f"--\n{anno.question}\n{overall_dic[key].question}\n--")
    overall_dic[key] = anno

  return overall_dic
Reads annotations from a file in either the gold or predicted format.

  Args:
    diffqg_fi: Path to the input file.

  Returns:
    Dictionary mapping a unique string identifier of the annotation to an
      Annotation object.
  
language/diffqg/annotation.py