def get_subtable_parent_format(subtable, table_page_title, table_section_title):
  """Convert subtable to PARENT format. Do not include section text."""
  table_parent_array = []
  # Table values.
  for cell in subtable:
    if cell["is_header"]:
      attribute = "header"
    else:
      attribute = "cell"
    value = cell["value"].strip()
    if value:
      value = value.replace("|", "-")
      entry = "%s|||%s" % (attribute, value)
      table_parent_array.append(entry)

  # Page title.
  if table_page_title:
    table_page_title = table_page_title.replace("|", "-")
    entry = "%s|||%s" % ("page_title", table_page_title)
    table_parent_array.append(entry)

  # Section title.
  if table_section_title:
    table_section_title = table_section_title.replace("|", "-")
    entry = "%s|||%s" % ("section_title", table_section_title)
    table_parent_array.append(entry)

  table_parent_str = "\t".join(table_parent_array)
  return table_parent_str
Convert subtable to PARENT format. Do not include section text.
language/totto/table_to_text_utils.py