MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / find_tables

Function find_tables

src/table.py:2593–2730  ·  view source on GitHub ↗
(
    page,
    clip=None,
    vertical_strategy: str = "lines",
    horizontal_strategy: str = "lines",
    vertical_lines: list = None,
    horizontal_lines: list = None,
    snap_tolerance: float = DEFAULT_SNAP_TOLERANCE,
    snap_x_tolerance: float = None,
    snap_y_tolerance: float = None,
    join_tolerance: float = DEFAULT_JOIN_TOLERANCE,
    join_x_tolerance: float = None,
    join_y_tolerance: float = None,
    edge_min_length: float = 3,
    min_words_vertical: float = DEFAULT_MIN_WORDS_VERTICAL,
    min_words_horizontal: float = DEFAULT_MIN_WORDS_HORIZONTAL,
    intersection_tolerance: float = 3,
    intersection_x_tolerance: float = None,
    intersection_y_tolerance: float = None,
    text_tolerance=3,
    text_x_tolerance=3,
    text_y_tolerance=3,
    strategy=None,  # offer abbreviation
    add_lines=None,  # user-specified lines
    add_boxes=None,  # user-specified rectangles
    paths=None,  # accept vector graphics as parameter
)

Source from the content-addressed store, hash-verified

2591
2592
2593def find_tables(
2594 page,
2595 clip=None,
2596 vertical_strategy: str = "lines",
2597 horizontal_strategy: str = "lines",
2598 vertical_lines: list = None,
2599 horizontal_lines: list = None,
2600 snap_tolerance: float = DEFAULT_SNAP_TOLERANCE,
2601 snap_x_tolerance: float = None,
2602 snap_y_tolerance: float = None,
2603 join_tolerance: float = DEFAULT_JOIN_TOLERANCE,
2604 join_x_tolerance: float = None,
2605 join_y_tolerance: float = None,
2606 edge_min_length: float = 3,
2607 min_words_vertical: float = DEFAULT_MIN_WORDS_VERTICAL,
2608 min_words_horizontal: float = DEFAULT_MIN_WORDS_HORIZONTAL,
2609 intersection_tolerance: float = 3,
2610 intersection_x_tolerance: float = None,
2611 intersection_y_tolerance: float = None,
2612 text_tolerance=3,
2613 text_x_tolerance=3,
2614 text_y_tolerance=3,
2615 strategy=None, # offer abbreviation
2616 add_lines=None, # user-specified lines
2617 add_boxes=None, # user-specified rectangles
2618 paths=None, # accept vector graphics as parameter
2619):
2620 pymupdf._warn_layout_once()
2621 CHARS.clear()
2622 EDGES.clear()
2623 TEXTPAGE = None
2624 old_small = bool(pymupdf.TOOLS.set_small_glyph_heights()) # save old value
2625 pymupdf.TOOLS.set_small_glyph_heights(True) # we need minimum bboxes
2626 if page.rotation != 0:
2627 page, old_xref, old_rot, old_mediabox = page_rotation_set0(page)
2628 else:
2629 old_xref, old_rot, old_mediabox = None, None, None
2630
2631 if snap_x_tolerance is None:
2632 snap_x_tolerance = UNSET
2633 if snap_y_tolerance is None:
2634 snap_y_tolerance = UNSET
2635 if join_x_tolerance is None:
2636 join_x_tolerance = UNSET
2637 if join_y_tolerance is None:
2638 join_y_tolerance = UNSET
2639 if intersection_x_tolerance is None:
2640 intersection_x_tolerance = UNSET
2641 if intersection_y_tolerance is None:
2642 intersection_y_tolerance = UNSET
2643 if strategy is not None:
2644 vertical_strategy = strategy
2645 horizontal_strategy = strategy
2646
2647 settings = {
2648 "vertical_strategy": vertical_strategy,
2649 "horizontal_strategy": horizontal_strategy,
2650 "explicit_vertical_lines": vertical_lines,

Callers

nothing calls this directly

Calls 15

page_rotation_set0Function · 0.85
TableFinderClass · 0.85
make_charsFunction · 0.85
make_edgesFunction · 0.85
_iouFunction · 0.85
make_table_from_bboxFunction · 0.85
TableClass · 0.85
page_rotation_resetFunction · 0.85
get_layoutMethod · 0.80
resolveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…