Agent Skillsxberg-io/xberg › ocr-pipeline-and-quality

ocr-pipeline-and-quality

GitHub

用于评估和优化OCR流水线,涵盖后端切换、预处理、缓存策略及结构重建。支持A/B质量测试与精度验证,不处理普通PDF文本提取。

.ai-rulez/skills/ocr-pipeline-and-quality/SKILL.md xberg-io/xberg

Trigger Scenarios

OCR后端行为变更或评估 A/B质量对比工作 OCR流程配置调整

Install

npx skills add xberg-io/xberg --skill ocr-pipeline-and-quality -g -y
More Options

Non-standard path

npx skills add https://github.com/xberg-io/xberg/tree/main/.ai-rulez/skills/ocr-pipeline-and-quality -g -y

Use without installing

npx skills use xberg-io/xberg@ocr-pipeline-and-quality

指定 Agent (Claude Code)

npx skills add xberg-io/xberg --skill ocr-pipeline-and-quality -a claude-code -g -y

安装 repo 全部 skill

npx skills add xberg-io/xberg --all -g -y

预览 repo 内 skill

npx skills add xberg-io/xberg --list

SKILL.md

Frontmatter
{
    "name": "ocr-pipeline-and-quality",
    "description": "Change or evaluate Xberg OCR backends, preprocessing, caching, page acceptance, geometry, hOCR structure, table reconstruction, or cross-backend quality. Load for OCR behavior and A\/B quality work, not ordinary PDF text extraction."
}

OCR pipeline and quality

OCR flows through preprocessing, backend execution, structured conversion, page acceptance, and caching. Backend outputs are not interchangeable measurements.

Backends and execution

  • All backends implement OcrBackend. Tesseract is the default and is bound through the in-repo crates/xberg-tesseract C FFI crate; there is no leptess dependency.
  • OcrBackendType is Tesseract | PaddleOCR | Candle | Custom. Sceptre is selected by name through Custom, not a dedicated enum variant.
  • Run blocking OCR work through tokio::task::spawn_blocking, minimize runtime/FFI lock duration, and respect backend resource limits.
  • Check PageOrientationHandling before assuming a backend handles rotated input.
  • Validate ISO 639 language codes and required tessdata before execution. Language detection runs after extraction and does not choose traineddata automatically.

Configuration and cache

  • Public types::formats::TesseractConfig and internal ocr::types::TesseractConfig have independent defaults. Change both and keep their synchronization test passing.
  • The OCR cache key combines image hash, backend, config hash, and output format. The config hash includes TESSERACT_RESULT_SCHEMA_VERSION and the ordered Tesseract variable set; it contains no build or code identity.
  • Bump TESSERACT_RESULT_SCHEMA_VERSION when unchanged image/config inputs can produce different output, or disable the cache for an A/B or revert check.
  • Default preprocessing is 300 DPI, deskew, and Otsu binarization. Auto-rotation, denoise, contrast enhancement, and color inversion are off unless configured. Native PSM defaults to 3; WASM defaults to 6.

Quality invariants

  • Query confidence_semantics() before interpreting confidence. Never threshold Uncalibrated output using a Tesseract-derived scale.
  • Tesseract font size is typography from hOCR x_fsize; Sceptre/Paddle font size is a geometric detection-box proxy. Do not compare or threshold them as the same quantity.
  • hocr_font_info=1 is required for Tesseract typography; without it font sizes fall back to 12 pt. Sceptre/Paddle do not provide hOCR style fractions.
  • accept_or_reject_ocr_page can discard an entire page and its structured paragraphs. Compare accepted pages before word counts. A missing dictionary-invalid ratio is unknown, not zero.
  • Precision is the scarce resource on the current benchmark corpus. Require an independently grounded F1 A/B for recall-oriented rewrites; use the benchmark-workflow skill.
  • Measure structural output such as headings and lists in Markdown, not Plain.

Tables and geometry

  • OCR table detection clusters word bounding boxes; it does not detect ruled lines or re-OCR cells.
  • Detect rows, merge words into cell tokens, then detect columns on the merged tokens. Use reconstruct_table_with_columns; detecting columns on raw words creates spurious columns for multi-word cells.
  • The PDF OCR raster is normalized to MediaBox-oriented user space. OCR segments carry rotation_degrees: 0.0; code reasoning about /Rotate pages must carry page rotation explicitly.
  • Preserve word-level bounding boxes, confidence, and reading order through hOCR parsing and validate a reconstructed grid before emitting Markdown.

Version History

  • d8e4815 Current 2026-08-28 18:30

Same Skill Collection

.ai-rulez/skills/alef-generated-bindings/SKILL.md
.ai-rulez/skills/benchmark-workflow/SKILL.md
.ai-rulez/skills/chunking-embeddings/SKILL.md
.ai-rulez/skills/config-loading-precedence/SKILL.md
.ai-rulez/skills/crate-structure/SKILL.md
.ai-rulez/skills/extraction-pipeline-patterns/SKILL.md
.ai-rulez/skills/feature-flag-policy/SKILL.md
.ai-rulez/skills/mime-detection-routing/SKILL.md
.ai-rulez/skills/pdf-backends/SKILL.md
.ai-rulez/skills/plugin-architecture-patterns/SKILL.md
.ai-rulez/skills/polyrepo-boundaries/SKILL.md
.ai-rulez/skills/release-readiness/SKILL.md
.ai-rulez/skills/release-versioning/SKILL.md
.ai-rulez/skills/test-corpus/SKILL.md
.ai-rulez/skills/wasm-constraints/SKILL.md
.ai-rulez/skills/xberg-typescript-toolchain/SKILL.md
plugin/.ai-rulez/skills/batch-extraction/SKILL.md
plugin/.ai-rulez/skills/chunking/SKILL.md
plugin/.ai-rulez/skills/extracting-keywords/SKILL.md
plugin/.ai-rulez/skills/extracting-tables/SKILL.md
plugin/.ai-rulez/skills/extracting-with-ocr/SKILL.md
plugin/.ai-rulez/skills/picking-a-format/SKILL.md
plugin/.ai-rulez/skills/xberg/SKILL.md
plugin/.cursor-plugin/skills/batch-extraction/SKILL.md
plugin/.cursor-plugin/skills/chunking/SKILL.md
plugin/.cursor-plugin/skills/extracting-keywords/SKILL.md
plugin/.cursor-plugin/skills/extracting-tables/SKILL.md
plugin/.cursor-plugin/skills/extracting-with-ocr/SKILL.md
plugin/.cursor-plugin/skills/picking-a-format/SKILL.md
plugin/.cursor-plugin/skills/xberg/SKILL.md
plugin/skills/batch-extraction/SKILL.md
plugin/skills/chunking/SKILL.md
plugin/skills/extracting-keywords/SKILL.md
plugin/skills/extracting-tables/SKILL.md
plugin/skills/extracting-with-ocr/SKILL.md
plugin/skills/picking-a-format/SKILL.md
plugin/skills/xberg/SKILL.md
.ai-rulez/skills/api-server-mcp/SKILL.md
.ai-rulez/skills/format-specific-extraction/SKILL.md

Metadata

Files
0
Version
d8e4815
Hash
c16597e2
Indexed
2026-08-28 18:30

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-01 03:36
浙ICP备14020137号-1 $bản đồ khách truy cập$