Skip to content

A fast, helpful, and open-source document parser

docs: document fromOCR and confidence fields in JSON output

lars4637308ae308
diff --git a/AGENTS.md b/AGENTS.md
index 2dcca3f..e97f2f8 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -59,7 +59,7 @@ The most complex (and important!) part of the codebase (`src/processing/gridProj
- **Forward anchors**: Carry alignment information between lines
- **Column detection**: Identifies multi-column layouts
- **Rotation handling**: Transforms 90°, 180°, 270° rotated text to correct reading order
-- **OCR merging**: Combines native PDF text with OCR results
+- **OCR merging**: Combines native PDF text with OCR results, preserving confidence scores and source flags in output
### 3. Selective OCR
OCR only runs on embedded images where text extraction failed, not the entire document. This balances accuracy with performance.
diff --git a/src/output/README.md b/src/output/README.md
index 7596759..5aeba4d 100644
--- a/src/output/README.md
+++ b/src/output/README.md
@@ -21,7 +21,9 @@ Output formatters that convert parsed document data into different formats.
text: string,
x, y, width, height: number,
fontName: string,
- fontSize: number
+ fontSize: number,
+ fromOCR?: boolean, // true for OCR-detected text
+ confidence?: number // 0.0-1.0, only for OCR items
}],
boundingBoxes: BoundingBox[],
}]