Skip to content

Commit d7e5043

Browse files
author
Chuang Men
committed
Improve the performance of table-extraction by judging whether to do "make_chars" or "make_edges" by checking strategy
1 parent 409ffde commit d7e5043

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/table.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,15 +2656,19 @@ def find_tables(
26562656
tset = TableSettings.resolve(settings=settings)
26572657
page.table_settings = tset
26582658

2659-
make_chars(page, clip=clip) # create character list of page
2660-
make_edges(
2661-
page,
2662-
clip=clip,
2663-
tset=tset,
2664-
paths=paths,
2665-
add_lines=add_lines,
2666-
add_boxes=add_boxes,
2667-
) # create lines and curves
2659+
if tset.vertical_strategy == "text" or tset.horizontal_strategy == "text":
2660+
make_chars(page, clip=clip) # create character list of page
2661+
if tset.vertical_strategy.startswith(
2662+
"lines"
2663+
) or tset.horizontal_strategy.startswith("lines"):
2664+
make_edges(
2665+
page,
2666+
clip=clip,
2667+
tset=tset,
2668+
paths=paths,
2669+
add_lines=add_lines,
2670+
add_boxes=add_boxes,
2671+
) # create lines and curves
26682672

26692673
tbf = TableFinder(page, settings=tset)
26702674

0 commit comments

Comments
 (0)