def get_parent_tables(json_example, mode="dev"):
  """Get tables in PARENT format for each json example."""
  table = json_example["table"]
  table_page_title = json_example["table_page_title"]
  table_section_title = json_example["table_section_title"]
  table_section_text = json_example["table_section_text"]

  cell_indices = json_example["highlighted_cells"]
  highlighted_subtable = (
      table_to_text_utils.get_highlighted_subtable(
          table=table, cell_indices=cell_indices))

  # Get PARENT format code.
  table_prec = table_to_text_utils.get_table_parent_format(
      table=table,
      table_page_title=table_page_title,
      table_section_title=table_section_title,
      table_section_text=table_section_text)

  table_rec = table_to_text_utils.get_subtable_parent_format(
      subtable=highlighted_subtable,
      table_page_title=table_page_title,
      table_section_title=table_section_title)

  overlap_table_prec = None
  overlap_table_rec = None
  nonoverlap_table_prec = None
  nonoverlap_table_rec = None
  if mode == "dev" or mode == "test":
    if json_example["overlap_subset"]:
      overlap_table_prec = table_prec
      overlap_table_rec = table_rec
    else:
      nonoverlap_table_prec = table_prec
      nonoverlap_table_rec = table_rec

  return (table_prec, table_rec, overlap_table_prec, overlap_table_rec,
          nonoverlap_table_prec, nonoverlap_table_rec)
Get tables in PARENT format for each json example.
language/totto/prepare_references_for_eval.py