xberg-extracting-with-ocr
यह क्या करती है
यह स्किल छवि-आधारित दस्तावेज़ों से OCR के ज़रिए टेक्स्ट निकालने का तरीका बताती है। यह उन लोगों के लिए है जिनके पास स्कैन किए कागज़ात, फ़ोटो खींचे गए पेज या स्क्रीनशॉट हैं।
कब इस्तेमाल करें
- ✓जब आपके पास स्कैन की गई PDF या किसी पेज की फ़ोटो हो और टेक्स्ट चाहिए।
- ✓जब PDF खाली या गड़बड़ निकले, पर स्क्रीन पर पढ़ने योग्य दिखे।
- ✓जब किसी दूसरी भाषा के दस्तावेज़ से टेक्स्ट चाहिए और भाषा सेट करनी हो।
Skill का लिंक
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-with-ocr/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस स्कैन किए गए अनुबंध PDF से टेक्स्ट निकालिए, जो स्पेनिश में लिखा है।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट OCR चालू करता है, या टेक्स्ट परत कमज़ोर होने पर हर पेज पर उसे ज़बरदस्ती लागू करता है। डिफ़ॉल्ट रूप से यह बिल्ट-इन Tesseract इंजन इस्तेमाल करता है और पहचान के लिए इस्तेमाल होने वाली भाषा सेट कर सकता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Extracting with OCR
Use this when a document is image-based: scanned PDFs, photographed pages, screenshots, JPEG/PNG/TIFF with text. Xberg auto-OCRs raster images and auto-detects PDFs that lack a text layer. Force it on when extraction returned empty/garbled text from a PDF that "looks" textual.
When to force OCR
- Extraction returned an empty
contentfield, but the file opens visually. - The PDF text layer is junk (copy-paste from a viewer produces gibberish).
- You want consistent output across mixed scanned + digital PDFs.
xberg extract scan.pdf --force-ocr=true
xberg extract scan.pdf --ocr=true --ocr-language eng
If a page has an unreliable text layer, --force-ocr=true re-rasterizes
and runs OCR on every page.
Backends
Tesseract is the default and ships with the CLI — no extra install. Other backends are opt-in:
| Backend | Flag | Install | Notes |
|---|---|---|---|
| Tesseract | --ocr-backend tesseract (default) |
bundled | Best general-purpose, 100+ languages via tessdata. |
| PaddleOCR | --ocr-backend paddle-ocr |
bundled (ONNX Runtime) | Strong on Asian scripts. Not available on WASM or Windows. |
| Candle VLM | --ocr-backend candle-trocr (and other candle-*) |
bundled (Candle) | Local vision OCR models (candle-trocr, candle-paddleocr-vl, candle-glm-ocr, candle-deepseek-ocr). |
| VLM (hosted) | --ocr-backend vlm + --vlm-model |
liter-llm provider (--vlm-api-key) |
Multimodal LLM via liter-llm. Use when OCR fails on dense or handwritten layouts. |
Pick Tesseract first. Switch only when accuracy is unacceptable.
Language packs
Tesseract uses ISO 639-2 codes. Default is eng. Combine with +:
xberg extract menu.jpg --ocr=true --ocr-language "eng+deu"
xberg extract bilingual.pdf --ocr-language "eng+jpn"
xberg extract any.pdf --ocr-language all # all installed packs
Install missing packs at the OS level:
# macOS
brew install tesseract-lang
# Debian/Ubuntu
sudo apt install tesseract-ocr-deu tesseract-ocr-jpn tesseract-ocr-fra
# Specific lang only
sudo apt install tesseract-ocr-<iso639-2>
Xberg fails fast with a helpful error if you request a language pack that is not installed. Read the error — it names the missing file.
Useful flags
--ocr=true— enable OCR (auto-enabled for images and scanned PDFs).--force-ocr=true— OCR every page even if a text layer exists.--disable-ocr=true— never OCR; use embedded text where available. Images and image-only pages can return metadata with no recognized text.--ocr-language <lang>— single code or+-joined list, orall.--ocr-backend <tesseract|paddle-ocr|vlm|candle-trocr|candle-paddleocr-vl|candle-glm-ocr|candle-deepseek-ocr>— pick backend.--ocr-auto-rotate=true— pre-rotate via the auto-rotate model.--acceleration <cpu|coreml|cuda|tensorrt|auto>— ONNX accelerator for paddle-ocr / auto-rotate / layout models.
Performance tips
- Cache is on by default. Repeated extraction of the same file + config is
instant. Do not pass
--no-cache=trueunless you have a reason. - For batch OCR, use
xberg batch *.pdf --ocr=true— internal worker pool parallelizes across CPU cores. Cap with--max-concurrent Nif memory is tight. - Raise
--target-dpi(default 300) only for low-resolution scans. Higher DPI is slower; 200 is usually enough for printed text. - Enable
--ocr-auto-rotate=trueonly when pages may be rotated; the classifier adds latency. - On Apple Silicon,
--acceleration coremltypically beats CPU for paddle-ocr and layout detection.
Config file alternative
Long flag chains belong in xberg.toml — auto-discovered from cwd
upward.
force_ocr = true
output_format = "markdown"
[ocr]
backend = "tesseract"
language = "eng+deu"
auto_rotate = true
Then just run:
xberg extract document.pdf
Common failure modes
- "missing tessdata" — install the language pack at OS level (see above).
- Empty content on a scanned PDF without
--force-ocr— the file has a bog
अक्सर पूछे जाने वाले सवाल
क्या OCR के लिए अलग सॉफ़्टवेयर चाहिए?
Tesseract टूल के साथ डिफ़ॉल्ट रूप से आता है, इसलिए बुनियादी उपयोग के लिए अलग इंस्टॉल नहीं चाहिए। दूसरे OCR इंजन वैकल्पिक हैं।
force OCR क्या है?
इसका मतलब है कि हर पेज OCR से पढ़ा जाए, भले ही उसमें कुछ टेक्स्ट पहले से हो।
कौन सी भाषाएँ सपोर्ट होती हैं?
Tesseract भाषा डेटा फ़ाइलों के ज़रिए 100 से ज़्यादा भाषाएँ सपोर्ट करता है।
जानकारी
लेखक का मूल विवरण
Use when extracting text from scanned PDFs, photographed pages, or images that have no embedded text layer. Covers OCR backends, language packs, force-OCR, and performance tuning.
repo: xberg-io/xberg
लोकप्रियता
- GitHub स्टार
- 9.5k
- रैंकिंग में स्थान
- #12272
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
xberg-batch-extraction
9.5kआपके एजेंट को Xberg के साथ एक साथ कई दस्तावेज़ प्रोसेस करने में मदद करती है। विकल्पों का एक सेट साझा होता है, समानांतर काम सीमित रहता है, और विफल फ़ाइलें पूरे रन को नहीं रोकतीं।
xberg-chunking
9.5kआपके एजेंट को लंबे दस्तावेज़ों का टेक्स्ट AI प्रॉम्प्ट या सर्च इंडेक्स के लिए छोटे टुकड़ों में बाँटने में मदद करती है, तय आकार और वैकल्पिक ओवरलैप के साथ।
xberg-extracting-keywords
9.5kआपके एजेंट को दस्तावेज़ से मुख्य कीवर्ड या मुख्य वाक्यांश निकालने और उसकी भाषा पहचानने में मदद करती है, Xberg की कीवर्ड सेटिंग के साथ।
xberg-extracting-tables
9.5kआपके एजेंट को PDF, स्प्रेडशीट और छवियों से तालिकाएँ निकालने में मदद करती है, पंक्तियाँ और कॉलम markdown या संरचित डेटा के रूप में सही रखते हुए।
मिलती-जुलती skills
feishu-doc
394kयह आपके एजेंट को document टूल से Feishu क्लाउड दस्तावेज़ पढ़ने, बनाने और बदलने में मदद करती है, जिसमें टेक्स्ट, इमेज और टेबल शामिल हैं।
feishu-drive
394kयह आपके एजेंट को बॉट के साथ साझा किए गए Feishu क्लाउड फ़ोल्डर में फ़ाइलें देखने, व्यवस्थित करने और उन पर टिप्पणी करने देती है।
feishu-perm
394kयह आपके एजेंट को Feishu फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।