Coverage for src / quber / core / fusion / __init__.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-09-23 22:14 -0400

1"""Fuse docling's spine with the Set-of-Mark/Camelot tables. 

2 

3docling and SoM/Camelot extract the same page and are each stronger at different 

4things, so this package fuses them — each enriches the other. SoM/Camelot owns 

5the vetted, text-grounded table bodies; docling owns the spine (reading order, 

6headings, text), an independent table count, picture classification, and the OCR 

7signal for regions read from the page image. 

8 

9`match_tables` pairs the two extractions by bounding-box overlap and classifies 

10each region (see `models.RegionMatch`). The graft and annotation passes act on 

11those records to produce the two corrected outputs: the SoM/Camelot tables and a 

12unified `DoclingDocument` whose table bodies come from Camelot. 

13 

14`fuse_artifacts` is the standalone fusion step (already-produced data in, both 

15outputs out); `DocumentFusion` is the local control flow that runs the document 

16and table extractions in-process and then fuses them. 

17""" 

18 

19from quber.core.fusion.fusion import DocumentFusion, fuse_artifacts 

20from quber.core.fusion.graft import build_unified_document, markdown_to_table_data 

21from quber.core.fusion.matching import MATCH_FRACTION, match_tables 

22from quber.core.fusion.models import FusionResult, MatchKind, RegionMatch 

23 

24__all__ = [ 

25 "MATCH_FRACTION", 

26 "DocumentFusion", 

27 "FusionResult", 

28 "MatchKind", 

29 "RegionMatch", 

30 "build_unified_document", 

31 "fuse_artifacts", 

32 "markdown_to_table_data", 

33 "match_tables", 

34]