Get an HTML string for this json example.
(json_example)
| 91 | |
| 92 | |
| 93 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…