File size: 6,226 Bytes
35d31f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
row_description_prompt = """You are a brilliant table assistant with the capabilities information retrieval, table parsing, and semantic understanding of the structural information of the table.

Here is a table in html format: \"{{html_table}}\"

We need to add a detailed description for each row of the table denoted by the "<tr>" tag element. The description should discuss the overall information inferred from the row. It should also mention all the elements, numbers, and figures present in the row. Also, include any hierarchical row/column header information.
    
Add this description as a "description" attribute in the <tr> tag. Repeat this process for ALL <tr> tags in the provided HTML. Do NOT delete any information that already exists in the other tags. Just print the html and do NOT output any other message. The HTML structure should NOT be changed.
"""

col_description_prompt = """You are a brilliant table assistant with the capabilities information retrieval, table parsing, and semantic understanding of the structural information of the table. 

Here is a table in html format: \"{{html_table}}\"

First, write a caption for the entire table that captures the general information being presented by all rows and columns in this table. Add it using the <caption> tag in the HTML.

Next, need to add a detailed description for each column of the table denoted by the "<th>" tag element. The description should discuss what elements are present in the column and the overall information that can be inferred by the column, including any hierarchical column header information.

Add this description as a "description" in the <th> tag. Repeat this process for ALL <th> tags in the provided HTML. Do NOT delete any information that already exists in the other tags.  Just print the html and do NOT output any other message. The HTML structure should NOT be changed.
"""

trend_description_prompt = """You are a brilliant table assistant with the capabilities information retrieval, table parsing, semantic understanding, and trend analysis of the structural information of the table. 
    
Here is a table in html format: \"{{html_table}}\".
        
We need to add a trend analysis on the elements in the given row compared to its own constituent cells and other rows in the table. The description should discuss semantic descriptions of numerical data, summarizing key quantitative characteristics and tendencies across the table row and across different columns.
    
Add this analysis in the \"description\" of the <tr> tag. Repeat this process for ALL <tr> tags in the provided HTML. Do NOT delete any information that already exists in the other tags.  Just print the html and do NOT output any other message. The HTML strcuture should NOT be changed.
"""

functional_attribution_prompt = """You are a brilliant assistant with the capabilities information retrieval, fact checking, and semantic understanding of tabular data.

Here is the html table - \"{{attributed_html_table}}\"

We have a list of facts pertaining to this table present in this JSON structure - \"{{fact_verification_function}}"\.
The JSON structure contains three empty fields - "Row Citations", "Column Citations", and "Explanation" that need to filled with relevant information.

We want to identify all the ROWS in the table that are important to support these facts. In other words, which rows are needed to collectively verify the facts. Please copy the "row-id" of all relevant table rows in the "Row Citation" field of the JSON structure. All rows IDs should be added in the form of a LIST "[... , ... , ...]" with no value repeated. Here is a sample: "Row Citations": ["row-2", "row-3"].
    
Similar to rows, we want to identify all the COLUMNS in the table that are important to support these facts. In other words, which columns are needed to collectively verify the facts. Please copy the "col-id" of all relevant table rows in the "Column Citation" field of the JSON structure. All column IDs should be added in the form of a LIST "[... , ... , ...]" with no value repeated. Here is a sample: "Column Citations": ["col-1", "col-5", "col-7"]

"Explanation" field should contain a detailed explanation of how the rows and columns identified in the "Row Citations" and "Column Citations" fields respectively, are important to verify the facts present in the JSON structure. The explanation should be coherent and provide a clear rationale for the selection of rows and columns.

The final result should be a complete JSON structure ONLY. Do not print any extra information. Make sure to fill the JSON structure accurately as provided in the prompt. 'Row citations',  'Column Citations', and 'Explanation' should not be empty.
"""


answer_decomposition_prompt = """

Here is a passage: \"{{answer}}\"

Convert the given passage into a list of short facts which specifically answer the given question. 
Make sure that the facts can be found in the given passage. 
The facts should be coherent and succinct sentences with clear and simple syntax. 
Do not use pronouns as the subject or object in the syntax of each fact. 
The facts should be independent to each other. 
Do not create facts from the passage which are not answering the given question.
ONLY return a python LIST of strings seperated by comma (,). Do NOT output any extra explanation. 
"""

table_image_to_html_prompt = """ Here is an image of a table. Please convert this table image into a HTML representation with accurate table cell data.
In order to help you in this process, here is a noisy HTML representation of the table extracted from the image: \"{{html_table}}\"
You may use this as a noisy reference and further refine the HTML structure to accurately represent the table data.
You should also add any information pertaining to row and column spans. In case of nested rows/columns with multiple spans, take be very careful to leave blank cells to ensure the semantic structure is maintained.
Be careful to handle hierarchical and nested rows/columns.
Each HTML should start with "<table>" opening tag.
Each HTML should end with "</table>" closing tag. 
Do NOT output any other explanation or text apart from the HTML code of the table.
"""