Skip to content

verbatim-ocr

Quality-assurance and verbatim-transcription standards for OCR'd legal documents in OKF matters. Use after the deterministic pipeline (okf-ocr skill, tools/ocr_pipeline.py) to verify sidecars, tables and figures against sources, or when transcribing an image/scan directly (vision models). Sets the precision bar: every word, figure, punctuation mark preserved exactly. Self-learning: appends QA lessons to learnings.md.

Source: .opencode/skills/verbatim-ocr/SKILL.md — site rebuilt 2026-09-05.


Verbatim OCR — QA & Transcription Standards

When to run

  • After okf-ocr pipeline runs: verify sidecars/tables/arithmetic against the source documents.
  • A vision-capable model is transcribing an image or scan directly (no text layer).
  • User asks to verify, proof-read, or quality-check OCR output.

Relationship to okf-ocr

  • okf-ocr OWNS the workflow: triage, pipeline, filing, logging, knowledge links.
  • This skill OWNS the precision standard: what "verbatim" means, what to check, what to flag.
  • The pipeline handles text-layer PDFs, scans (PaddleOCR), tables (pdfplumber), and arithmetic (pandas). The model's role is QA, not re-transcription — except where noted below.

Self-learning

learnings.md sits next to this SKILL.md — read before QA, append new dated lessons after.

Core principle

This is a verbatim transcription. You are a digital scribe, not an editor. Every word, figure, punctuation mark, capitalisation, and line break is preserved exactly as it appears in the source. This is a legal document — precision is not optional.

QA workflow (after pipeline)

1. Read the source + sidecar

  • Read the sidecar <name>_V1_OCR.txt and _pipeline.json produced by the pipeline.
  • Check the QA flags first (result.qa): PASS means verify metadata + key figures only; PARTIAL means review each [LOW CONFIDENCE n.nnn] line against the source; FAIL means stop and report.
  • Check EVERY page is present (sidecar must contain --- PAGE N --- for all N).
  • Read the source document (PDF via Read tool if vision; otherwise rely on the pipeline's method map — text-layer pages are exact, PaddleOCR pages carry confidence scores).

2. Verify figures (highest risk)

  • Dates, amounts, quantities, percentages, reference numbers, postcodes — must match the source EXACTLY.
  • Do not convert formats (e.g. do not change "£1,234.56" to "£1234.56").
  • A single wrong digit in a payment amount or date is a material error. If in doubt, re-read the source.
  • If a figure cannot be verified from the source, flag [UNVERIFIED: figure] in the log.

3. Verify tables + arithmetic

  • Check the tables CSV reproduces the source structure: same columns, rows, grouping.
  • Check every row total and column total. The pipeline's pandas pass auto-flags [ARITHMETIC ERROR: expected X, found Y] and [NO TOTAL ROW: sum calculated = X] — confirm the flags reflect the SOURCE (never silently correct; the flag documents reality).
  • If the pipeline missed a table, add it manually to the CSV with [ADDED BY QA] note.
  • If sums do not balance in the source, the flag stays — that is a finding, not an error to fix.

4. Transcribe direct (vision model, no pipeline)

If transcribing an image/scan directly, preserve:

  • All spelling, including errors, archaic forms, abbreviations, regional variants ("the said", "herein", "notwithstanding")
  • All punctuation — commas, semicolons, colons, full stops, dashes, brackets, quotation marks
  • All capitalisation — headings, case names, defined terms, proper nouns
  • Paragraph breaks — blank lines between paragraphs
  • Formatting cues — underlining, bold (note as [UNDERLINED] or [BOLD]), numbered/lettered lists
  • Headers and footers — court stamps, page numbers, document titles
  • Signatures and annotations — note "[SIGNED]"; handwritten as [HANDWRITTEN: text if legible]
  • Never add or remove content — no summaries, no interpretations, no corrections
  • If you cannot read a section, use [ILLEGIBLE] and continue from where legibility resumes

5. Metadata extraction

While checking, capture: - Document type: letter, email, submission, contract, certificate, invoice, schedule, notice - Parties: sender(s) and recipient(s) as they appear - Date: document date or date received (use the date in the document, not the file date) - Key figures: contract sums, payment amounts, dates of notice, expiry dates, claim amounts

Record these in the 97_OCR_Log entry (okf-ocr skill handles the write).

6. Quality thresholds

  • Figures must match exactly — single wrong digit = material error.
  • Tables must balance — arithmetic errors in the source are noted, never silently corrected.
  • Scan quality: if text is genuinely unreadable (not just faint), stop and report rather than guessing. Flag Quality_Check = FAIL: unreadable.
  • Multi-page documents: every page present; partial transcription acceptable only if scan quality degrades partway — note where it stops.

7. Learn

Append NEW QA lessons to learnings.md (dated bullets) — OCR failure patterns, table structures that trip extraction, illegibility patterns.

Model capability & handoff

  • All processing happens within opencode; no document content is shared externally.
  • Non-vision models: the pipeline does the transcription (text layer + PaddleOCR) — you can run and QA the OUTPUT even without vision by checking page counts, table CSVs, and arithmetic flags, and by re-reading the source PDF's text layer. Only visual confirmation of scan quality requires vision; flag unconfirmed scan pages as Quality_Check = PARTIAL and note it.

Example

User: "QA the OCR output" — for each pipeline result, verify figures/tables against source, flag discrepancies, confirm metadata, log results, append learnings.