File tree 2 files changed +10
-9
lines changed
2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -3181,7 +3181,6 @@ def exportJSON(self):
3181
3181
"""
3182
3182
export PPLabel and CSV to JSON (PubTabNet)
3183
3183
"""
3184
- import pandas as pd
3185
3184
3186
3185
# automatically save annotations
3187
3186
self .saveFilestate ()
Original file line number Diff line number Diff line change @@ -232,14 +232,16 @@ def convert_token(html_list):
232
232
elif col == "td" :
233
233
token_list .extend (["<td>" , "</td>" ])
234
234
else :
235
- token_list .append ("<td" )
236
- if "colspan" in col :
237
- _ , n = col .split ("colspan=" )
238
- token_list .append (' colspan="{}"' .format (int (n )))
239
- if "rowspan" in col :
240
- _ , n = col .split ("rowspan=" )
241
- token_list .append (' rowspan="{}"' .format (int (n )))
242
- token_list .extend ([">" , "</td>" ])
235
+ token_list .append ("<td" ) # Start the td tag
236
+ # Use regex to match "colspan" and "rowspan" attributes and their values
237
+ colspan_match = re .search (r"colspan=(\d+)" , col )
238
+ rowspan_match = re .search (r"rowspan=(\d+)" , col )
239
+ if colspan_match :
240
+ token_list .append (f' colspan="{ colspan_match .group (1 )} "' )
241
+ if rowspan_match :
242
+ token_list .append (f' rowspan="{ rowspan_match .group (1 )} "' )
243
+ token_list .append (">" ) # End the opening td tag
244
+ token_list .append ("</td>" ) # Close the td tag
243
245
token_list .append ("</tr>" )
244
246
token_list .append ("</tbody>" )
245
247
You can’t perform that action at this time.
0 commit comments