File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -44,18 +44,18 @@ def t2j(df):
44
44
45
45
def tables2json (tables_dir ):
46
46
metadata , tables , celltags = get_tables (tables_dir )
47
- all_data = {}
47
+ all_data = []
48
48
for arxiv_id in metadata :
49
- table = {'metadata' : metadata [arxiv_id ]}
50
49
tabs = []
51
- cts = []
52
- for tab in tables [arxiv_id ]:
53
- tabs .append (t2j (tables [arxiv_id ][tab ]))
54
- for ct in celltags [arxiv_id ]:
55
- cts .append (t2j (celltags [arxiv_id ][ct ]))
56
- table ['tables' ] = tabs
57
- table ['celltags' ] = cts
58
- all_data [arxiv_id ] = table
50
+ for tab in metadata [arxiv_id ]:
51
+ table = dict (
52
+ name = tab ,
53
+ caption = metadata [arxiv_id ][tab ],
54
+ values = t2j (tables [arxiv_id ][tab ]),
55
+ tags = t2j (celltags [arxiv_id ][tab ])
56
+ )
57
+ tabs .append (table )
58
+ all_data .append (dict (paper_id = arxiv_id , tables = tabs ))
59
59
print (json .dumps (all_data ))
60
60
61
61
if __name__ == '__main__' : fire .Fire (tables2json )
You can’t perform that action at this time.
0 commit comments