def load_example_from_jsonl(path_name):
  """Load Decontext input jsonl file into DecontextExample."""
  output_list = []
  with open(path_name) as input_file:
    for line in input_file:
      json_elem = json.loads(line)
      annotations = [
          load_decontext_label_from_dict(annot_dict)
          for annot_dict in json_elem.get('annotations', [])
      ]
      para_text = json_elem['paragraph_text']
      sent_start_offset = json_elem['sentence_start_byte_offset']
      sent_end_offset = json_elem['sentence_end_byte_offset']
      example = DecontextExample(
          example_id=json_elem['example_id'],
          paragraph_text=para_text,
          sent_start_byte_offset=sent_start_offset,
          sent_end_byte_offset=sent_end_offset,
          article_url=json_elem['article_url'],
          article_title=json_elem['page_title'],
          section_title_list=json_elem['section_title'],
          annotations=annotations)
      output_list.append(example)
    return output_list
Load Decontext input jsonl file into DecontextExample.
language/decontext/decontext_util.py