मुख्य सामग्री पर जाएँ
Skillpedia
एनालिसिस और स्प्रेडशीट9.5k · #12269

xberg-chunking

यह क्या करती है

यह स्किल बताती है कि लंबे टेक्स्ट को ऐसे टुकड़ों में कैसे काटें जो AI मॉडल की context window या सर्च डेटाबेस में फ़िट हों। यह AI सर्च या दस्तावेज़ प्रश्नोत्तर टूल बनाने वालों के लिए है।

कब इस्तेमाल करें

  • ✓जब आपको किसी लंबे दस्तावेज़ को आकार-सीमा वाले AI टूल में डालना हो।
  • ✓जब आप दस्तावेज़ों से सर्च इंडेक्स या RAG सिस्टम बना रहे हों।
  • ✓जब आपके पास टेक्स्ट हो और आप उसे तय आकार के टुकड़ों में बाँटना चाहें।

Skill का लिंक

https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-chunking/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-chunking/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस 80 पेज की रिपोर्ट को लगभग 1000 अक्षरों के टुकड़ों में थोड़े ओवरलैप के साथ बाँटिए, ताकि मैं इसे अपने AI सर्च में डाल सकूँ।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट या तो निष्कर्षण के दौरान chunking चालू करता है, या आपके पास मौजूद टेक्स्ट पर अलग chunk कमांड चलाता है। वह टुकड़े का आकार और ओवरलैप सेट करता है, और जाँचता है कि ओवरलैप टुकड़े के आकार से छोटा है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Chunking

Use this when feeding documents into an LLM context window or a vector store. Xberg chunks two ways: inline during extraction (chunks land on each document's chunks field), or standalone via the chunk command for text you already have. Sizing is character-based by default, or token-based when a tokenizer model is supplied.

Inline during extraction

Turn on chunking with --chunk and the chunks appear on the structured result under chunks:

# 1000-char chunks, 200-char overlap (defaults when --chunk is on)
xberg extract report.pdf --chunk --format json | jq '.result.chunks | length'

# Explicit size + overlap
xberg extract report.pdf --chunk --chunk-size 1500 --chunk-overlap 300 --format json

Overlap must be smaller than chunk size — the CLI rejects --chunk-overlap >= --chunk-size. When you set only --chunk-overlap against an existing config, an overlap that exceeds the size is clamped to chunk_size / 4.

Standalone chunk command

Chunk text you already have, from --text or stdin. Output defaults to JSON:

# From a flag
xberg chunk --text "long document text ..." --chunk-size 800 --chunk-overlap 100

# From stdin (pipe extracted content straight in)
xberg extract notes.md | xberg chunk --chunk-size 500 --format json

JSON output carries chunks (array of strings), chunk_count, the resolved config (max_characters, overlap, chunker_type), and input_size_bytes. Use --format text for a human-readable dump with --- chunk N --- separators.

Note: in the JSON output, chunker_type is rendered capitalized ("Text", "Markdown", "Yaml", "Semantic") because it is emitted via Rust's Debug formatting, whereas the --chunker-type input flag is lowercase (text, markdown, yaml, semantic). Lowercase the value before comparing if you parse it back.

Chunker types

--chunker-type selects the splitting strategy (standalone chunk command):

Type Behavior
text Default. Plain character-window splitting with overlap.
markdown Markdown-aware — splits on structure (headings, blocks) where possible.
yaml YAML-aware splitting for structured config/data documents.
semantic Topic-boundary splitting driven by --topic-threshold (0.0–1.0, default 0.75).
# Markdown-aware chunking keeps headings and blocks intact
xberg chunk --text "$(cat README.md)" --chunker-type markdown

# Semantic chunking — lower threshold = more, smaller topic chunks
xberg chunk --text "$(cat transcript.txt)" --chunker-type semantic --topic-threshold 0.6

Token-based sizing

By default --chunk-size counts characters. To size chunks by tokens for a specific model, pass --chunking-tokenizer with a HuggingFace tokenizer id. On the extract command this implicitly enables chunking. Requires the chunking-tokenizers feature (present in the default CLI build).

# Size chunks by GPT-4o tokens during extraction
xberg extract report.pdf --chunking-tokenizer Xenova/gpt-4o --format json

# Or on the standalone command
xberg chunk --text "$(cat doc.txt)" --chunking-tokenizer Xenova/gpt-4o --chunk-size 512

With a tokenizer set, --chunk-size is interpreted in tokens, not characters.

Config file alternative

Field names in config files are snake_case under [chunking]:

[chunking]
max_characters = 1000
overlap = 200
chunker_type = "markdown"
xberg extract report.pdf --config xberg.toml --format json

CLI flags map to config fields as --chunk-size → max_characters and --chunk-overlap → overlap. In config files use the snake_case names.

Programmatic access

From Python, enable chunking on the config and read the chunks off the document in the result envelope (result.results[0].chunks):

from xberg import ExtractInput, extract, ExtractionConfig, ChunkingConfig

config = ExtractionConfig(
    chunking=ChunkingConfig(max_characters=1000, overlap=200),
)
result = await extract(ExtractInput(uri="report.pdf"), config)
for chunk in result.results[0].chunks or []:
    print(len(chunk.content))

The public Python ChunkingConfig (a dataclass) uses constructor kwargs max_characters / overlap; the Rust core struct fields are also max_characters / overlap. TOML/JSON conf

अक्सर पूछे जाने वाले सवाल

ओवरलैप किस लिए है?

ओवरलैप पड़ोसी टुकड़ों के बीच थोड़ा टेक्स्ट दोहराता है, ताकि सीमा पर कटा वाक्य किसी एक टुकड़े में पूरा दिखे।

क्या टुकड़े टोकन से तय हो सकते हैं?

हाँ, जब tokenizer मॉडल दिया गया हो। नहीं तो आकार अक्षरों में गिना जाता है।

अगर ओवरलैप बहुत बड़ा हो तो?

कमांड ऐसा ओवरलैप अस्वीकार कर देता है जो टुकड़े के आकार के बराबर या उससे बड़ा हो।

जानकारी

लेखक का मूल विवरण

Use when splitting extracted text into chunks for LLM context windows or RAG ingestion. Covers chunk size, overlap, markdown/yaml/semantic chunkers, tokenizer-based sizing, and the standalone `chunk` command.

repo: xberg-io/xberg

लोकप्रियता

GitHub स्टार
9.5k
रैंकिंग में स्थान
#12269
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

xberg-batch-extraction

9.5k

आपके एजेंट को Xberg के साथ एक साथ कई दस्तावेज़ प्रोसेस करने में मदद करती है। विकल्पों का एक सेट साझा होता है, समानांतर काम सीमित रहता है, और विफल फ़ाइलें पूरे रन को नहीं रोकतीं।

लेखन और डॉक्यूमेंटPDF, Word और स्लाइड

xberg-extracting-keywords

9.5k

आपके एजेंट को दस्तावेज़ से मुख्य कीवर्ड या मुख्य वाक्यांश निकालने और उसकी भाषा पहचानने में मदद करती है, Xberg की कीवर्ड सेटिंग के साथ।

डेटाएनालिसिस और स्प्रेडशीट

xberg-extracting-tables

9.5k

आपके एजेंट को PDF, स्प्रेडशीट और छवियों से तालिकाएँ निकालने में मदद करती है, पंक्तियाँ और कॉलम markdown या संरचित डेटा के रूप में सही रखते हुए।

लेखन और डॉक्यूमेंटPDF, Word और स्लाइड

xberg-extracting-with-ocr

9.5k

आपके एजेंट को स्कैन की गई PDF, फ़ोटो और ऐसी छवियों से टेक्स्ट पढ़ने में मदद करती है जिनमें टेक्स्ट परत नहीं है, वैकल्पिक भाषा पैक के साथ OCR का उपयोग करके।

लेखन और डॉक्यूमेंटPDF, Word और स्लाइड

मिलती-जुलती skills