MCPcopy Create free account
hub / github.com/google-research/language / get_example_html

Function get_example_html

language/totto/table_to_text_html_utils.py:93–120  ·  view source on GitHub ↗

Get an HTML string for this json example.

(json_example)

Source from the content-addressed store, hash-verified

91
92
93def get_example_html(json_example):
94 """Get an HTML string for this json example."""
95 annotations = json_example["sentence_annotations"]
96 table_html = ""
97 final_sentences = []
98
99 table_page_title = json_example["table_page_title"]
100 table_section_title = json_example["table_section_title"]
101 table_section_text = json_example["table_section_text"]
102 highlighted_cells = json_example["highlighted_cells"]
103 table_html = get_table_html(json_example["table"], highlighted_cells)
104
105 if not table_section_text:
106 table_section_text = "<i> None </i>"
107
108 for annotation in annotations:
109 final_sentences.append(annotation["final_sentence"])
110
111 html_header = get_html_header(table_page_title)
112 all_final_sentences = "<h3>Sentence(s)</h3>" + "<br> ".join(final_sentences)
113
114 html_str = (
115 "%s <b>Section Title</b>: %s <br><b>Table Section Text</b>: %s <br> %s "
116 "<br> %s </body></html>" %
117 (html_header, table_section_title, table_section_text, table_html,
118 all_final_sentences))
119
120 return html_str

Callers

nothing calls this directly

Calls 2

get_table_htmlFunction · 0.85
get_html_headerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…