7 KiB
Images and Figures: OCR Parsing Guardrails
🧭 Quick Return to Map
You are in a sub-page of OCR_Parsing.
To reorient, go back here:
- OCR_Parsing — text recognition and document structure parsing
- WFGY Global Fix Map — main Emergency Room, 300+ structured fixes
- WFGY Problem Map 1.0 — 16 reproducible failure modes
Think of this page as a desk within a ward.
If you need the full triage and all prescriptions, return to the Emergency Room lobby.
Stabilize text extraction around inline images, charts, and figures. Prevent figure captions or axis labels from bleeding into body text, and preserve semantic anchors for later retrieval.
Open these first
- OCR end to end checklist: ocr-parsing-checklist.md
- Snippet and citation schema: data-contracts.md
- Retrieval traceability: retrieval-traceability.md
- Chunking checklist: chunking-checklist.md
Acceptance targets
- ΔS(question, retrieved) ≤ 0.45 on captioned answers
- Coverage ≥ 0.70 for questions tied to figure anchors
- λ remains convergent across three paraphrases
- Captions and labels stored separately from body text
Typical failure signatures → fix
-
Figure captions merged with paragraphs
Split by bbox banding and assignfigure_caption. Keep paragraph tokens clean. -
Axis labels or legend entries treated as running text
Extract intofigure_metadata.axis_labelsandfigure_metadata.legend. Never merge into narrative. -
Scanned figure with embedded text
Route figure OCR separately. Keepfigure_id,text_extracted, and bounding box. Tie back to figure image reference. -
Multi-column figure bleed
If caption spans columns, capture as caption block, not as content. Anchor tofigure_id. -
Images with no OCR text
Provide stub withfigure_id,bbox, andalt_textif known. Maintain traceability.
Fix in 60 seconds
-
Detect figure zones
Identify bounding boxes flagged as images or graphics. Assignfigure_id. -
Isolate captions
If text appears immediately above/below the figure and repeats formatting (italic, smaller font), tag as caption. -
Route labels
Apply heuristic rules for x-axis, y-axis, legend. Store underfigure_metadata. -
Clean narrative
Remove all figure-related text fromtext_clean. Retain only in figure structures. -
Probe retrieval
Ask a figure-specific question. If ΔS ≤ 0.45 and λ stable, cleanup succeeded.
Minimal recipes by engine
-
Google Document AI
Uselayout.figureand boundingPoly. Capture associatedparagraphblocks as captions when within ±10% of figure bbox. -
AWS Textract
DetectBlockType=KEY_VALUE_SETaround figure images. Treat them as labels, route intofigure_metadata. -
Azure OCR
Use boundingRegions and detect blocks adjacent to figures. Anchor captions if directly above/below polygon. -
ABBYY
In XML,<block type="Picture">+ following<par>→ caption. Inline text with picture coordinates goes to figure metadata. -
PaddleOCR
Split text lines overlapping with figure bbox. Store separately as figure text, not narrative.
Data contract additions for figures
{
"figure\_id": "fig3",
"bbox": \[x0,y0,x1,y1],
"caption": "Figure 3: Error rate across embedding sizes.",
"figure\_metadata": {
"axis\_labels": \["tokens","ΔS"],
"legend": \["baseline","with WFGY"],
"text\_extracted": "0.45, 0.30..."
},
"section\_id": "4.2",
"page": 12,
"source\_url": "..."
}
Mandatory: all figure text lives in figure_metadata or caption, never in text_clean.
Verification
- Leak check: ensure no caption/axis strings appear in
text_clean. - Figure QA: ask "what does fig3 show?" — answer must cite
figure_id. - ΔS probe: figure-specific questions yield ΔS ≤ 0.45.
- λ probe: paraphrases about same figure converge.
Copy-paste LLM prompt
You have TXT OS and WFGY Problem Map.
For figure-linked snippets:
* use text\_clean for reasoning,
* use caption and figure\_metadata for figure answers,
* cite figure\_id.
Tasks:
1. If figure text leaks into body, fail fast and return fix reference (ocr-parsing-checklist, data-contracts, retrieval-traceability).
2. Return JSON:
{ "citations":\["fig3"], "answer":"...", "λ\_state":"...", "ΔS":0.xx, "next\_fix":"..." }
🔗 Quick-Start Downloads (60 sec)
| Tool | Link | 3-Step Setup |
|---|---|---|
| WFGY 1.0 PDF | Engine Paper | 1️⃣ Download · 2️⃣ Upload to your LLM · 3️⃣ Ask “Answer using WFGY + <your question>” |
| TXT OS (plain-text OS) | TXTOS.txt | 1️⃣ Download · 2️⃣ Paste into any LLM chat · 3️⃣ Type “hello world” — OS boots instantly |
Explore More
| Layer | Page | What it’s for |
|---|---|---|
| ⭐ Proof | WFGY Recognition Map | External citations, integrations, and ecosystem proof |
| ⚙️ Engine | WFGY 1.0 | Original PDF tension engine and early logic sketch (legacy reference) |
| ⚙️ Engine | WFGY 2.0 | Production tension kernel for RAG and agent systems |
| ⚙️ Engine | WFGY 3.0 | TXT based Singularity tension engine (131 S class set) |
| 🗺️ Map | Problem Map 1.0 | Flagship 16 problem RAG failure taxonomy and fix map |
| 🗺️ Map | Problem Map 2.0 | Global Debug Card for RAG and agent pipeline diagnosis |
| 🗺️ Map | Problem Map 3.0 | Global AI troubleshooting atlas and failure pattern map |
| 🧰 App | TXT OS | .txt semantic OS with fast bootstrap |
| 🧰 App | Blah Blah Blah | Abstract and paradox Q&A built on TXT OS |
| 🧰 App | Blur Blur Blur | Text to image generation with semantic control |
| 🏡 Onboarding | Starter Village | Guided entry point for new users |
If this repository helped, starring it improves discovery so more builders can find the docs and tools.