Recover columns, baselines, and reading order from raw OCR bounding boxes.
npm install afferentimport { processPageLayout, stitchCrossPageDocument } from "afferent";
// 1. Process 2D page geometry (columns, horizontal baselines, line clusters)
const layout = await processPageLayout(ocrLines);
// 2. Stitch ambiguous cross-page boundaries (with optional System 1 semantic resolution)
const pages = await stitchCrossPageDocument([page1, page2], client);