xberg-batch-extraction
यह क्या करती है
यह स्किल दिखाती है कि एक ही बार में किसी फ़ोल्डर या फ़ाइल सूची में दस्तावेज़ों से टेक्स्ट कैसे निकालें। यह उन लोगों के लिए है जिनके पास बहुत सारे दस्तावेज़ हैं और जो हर फ़ाइल की त्रुटियाँ अलग सूचीबद्ध होते हुए एक नतीजा चाहते हैं।
कब इस्तेमाल करें
- ✓जब आपके पास PDF या Word फ़ाइलों का फ़ोल्डर हो जिसे एक साथ प्रोसेस करना है।
- ✓जब आप हर फ़ाइल पर एक ही निष्कर्षण विकल्प लागू करना चाहें।
- ✓जब कुछ फ़ाइलें विफल हो सकती हों और फिर भी बाकी के नतीजे चाहिए।
Skill का लिंक
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-batch-extraction/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे reports फ़ोल्डर की हर PDF से एक ही रन में टेक्स्ट निकालिए, और बताइए कौन सी फ़ाइलें विफल रहीं।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट आपकी फ़ाइल सूची पर बैच कमांड चलाता है, साझा सेटिंग लागू करता है, एक समय में सीमित संख्या में फ़ाइलें प्रोसेस करता है, और सफल नतीजों के साथ त्रुटियाँ भी लौटाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Batch extraction
Use this when processing a directory or glob of documents in one pass.
xberg batch shares one extraction config across every file, runs
extractions concurrently, and returns a JSON envelope — failures on
individual files do not abort the run.
Basic usage
# Glob expands to many paths; results come back in a JSON envelope (default)
xberg batch *.pdf
# Mixed formats, markdown content for LLM ingestion
xberg batch docs/*.docx --content-format markdown
# Recurse with the shell, then extract
xberg batch $(find ./corpus -name '*.pdf')
batch defaults to --format json (vs --format text for single
extract). The envelope contains results, total_ms, per_file_ms and, when failures
occur, errors. Each results entry is a full extracted document. One input may produce
multiple documents, so do not pair results with inputs by position. per_file_ms is
aligned with inputs; inspect errors for per-input failures.
xberg batch reports/*.pdf \
| jq '.results[] | {chars: (.content | length), mime: .mime_type}'
Parallelism
--max-concurrent caps how many files extract at once. When omitted, the scheduler derives document concurrency from the total thread budget. Lower it on memory-constrained hosts or when OCR/ML
models are active, since each in-flight extraction holds its own buffers.
Layout-heavy batches are further limited (1 concurrent extraction for
all-PDF-layout batches, 2 for mixed layout):
# Cap at 4 concurrent extractions
xberg batch scans/*.pdf --ocr true --max-concurrent 4
--max-threads additionally caps total internal threads (Rayon, ONNX
intra-op, the batch semaphore) for tightly constrained environments:
xberg batch *.pdf --max-concurrent 2 --max-threads 4
Per-file config overrides
A single shared config does not always fit. --file-configs points at a
JSON file mapping each path to its own override object, merged on top of
the shared config for that file only:
{
"scan.pdf": { "force_ocr": true },
"report.pdf": { "output_format": "markdown" },
"data.xlsx": { "output_format": "json" }
}
xberg batch scan.pdf report.pdf data.xlsx --file-configs overrides.json
Keys are file paths (matching the paths passed on the command line); values are per-file extraction config objects in snake_case, the same shape as a config file.
Output layout
For text/toon output with image extraction, --output-dir controls where
referenced image files (e.g. image_0.png) are written; the directory
must already exist. JSON output embeds image bytes inline and ignores
--output-dir.
mkdir -p out/images
xberg batch slides/*.pptx --extract-images true --output-dir out/images --format text
Error recovery
Batch extraction is fault-tolerant per file: one unreadable or corrupt
document does not stop the rest. Inspect results for partial content and
surfaced errors rather than relying on the process exit code alone. Pair
with --max-concurrent to avoid exhausting memory when a few large files
sit in a big batch.
Shared config
Every extract flag also applies to batch (OCR, chunking, layout,
content format, etc.) and is shared across all files unless a
--file-configs entry overrides it:
xberg batch invoices/*.pdf \
--layout --layout-table-model slanet_wireless \
--content-format markdown --max-concurrent 8
A config file works too and auto-discovers from the cwd upward:
output_format = "markdown"
[ocr]
backend = "tesseract"
language = "eng"
xberg batch corpus/*.pdf --config xberg.toml
Programmatic access
From Python, extract_batch takes a list of ExtractInputs and returns one
envelope whose results array holds a document per input:
from xberg import ExtractInput, extract_batch, ExtractionConfig
config = ExtractionConfig(output_format="markdown")
inputs = [ExtractInput(uri=p) for p in ["a.pdf", "b.docx", "c.xlsx"]]
output = await extract_batch(inputs, config)
for doc in output.results:
print(len(doc.content))
Per-input overrides go on ExtractInput.config (a FileExtractionConfig).
Node.js mirrors this with extractBatch; Rust uses extract_batch(inputs, &config).
See ../../references/python-api.md, ../../references/nodejs-api.md, and
../../references/rust-api.md.
MCP
When the xberg MCP server is registered, prefer the
extract_batch tool over shelling out — it takes an array of inpu
अक्सर पूछे जाने वाले सवाल
क्या एक खराब फ़ाइल पूरे रन को रोक देगी?
नहीं। अलग-अलग फ़ाइलों की विफलता बैच के बाकी हिस्से को नहीं रोकती।
मैं लोड कैसे नियंत्रित करूँ?
एक सेटिंग एक समय में प्रोसेस होने वाली फ़ाइलों की संख्या सीमित करती है, जो कम मेमोरी वाले कंप्यूटरों पर मदद करती है।
क्या अलग फ़ाइलें अलग सेटिंग इस्तेमाल कर सकती हैं?
हाँ। स्किल प्रति-फ़ाइल ओवरराइड के लिए file-configs विकल्प का ज़िक्र करती है।
जानकारी
लेखक का मूल विवरण
Use when extracting from many files at once with shared config, bounded parallelism, per-file overrides, and error recovery. Covers the `batch` command, `--file-configs`, `--max-concurrent`, and output layout.
repo: xberg-io/xberg
लोकप्रियता
- GitHub स्टार
- 9.5k
- रैंकिंग में स्थान
- #12268
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
xberg-chunking
9.5kआपके एजेंट को लंबे दस्तावेज़ों का टेक्स्ट AI प्रॉम्प्ट या सर्च इंडेक्स के लिए छोटे टुकड़ों में बाँटने में मदद करती है, तय आकार और वैकल्पिक ओवरलैप के साथ।
xberg-extracting-keywords
9.5kआपके एजेंट को दस्तावेज़ से मुख्य कीवर्ड या मुख्य वाक्यांश निकालने और उसकी भाषा पहचानने में मदद करती है, Xberg की कीवर्ड सेटिंग के साथ।
xberg-extracting-tables
9.5kआपके एजेंट को PDF, स्प्रेडशीट और छवियों से तालिकाएँ निकालने में मदद करती है, पंक्तियाँ और कॉलम markdown या संरचित डेटा के रूप में सही रखते हुए।
xberg-extracting-with-ocr
9.5kआपके एजेंट को स्कैन की गई PDF, फ़ोटो और ऐसी छवियों से टेक्स्ट पढ़ने में मदद करती है जिनमें टेक्स्ट परत नहीं है, वैकल्पिक भाषा पैक के साथ OCR का उपयोग करके।
मिलती-जुलती skills
feishu-doc
394kयह आपके एजेंट को document टूल से Feishu क्लाउड दस्तावेज़ पढ़ने, बनाने और बदलने में मदद करती है, जिसमें टेक्स्ट, इमेज और टेबल शामिल हैं।
feishu-drive
394kयह आपके एजेंट को बॉट के साथ साझा किए गए Feishu क्लाउड फ़ोल्डर में फ़ाइलें देखने, व्यवस्थित करने और उन पर टिप्पणी करने देती है।
feishu-perm
394kयह आपके एजेंट को Feishu फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।