smithery/findinfinitelabs

intelligent-text-chunking

Split long Chuukese/English documents into chunks for OCR pipelines, AI training, or retrieval — using the in-repo `IntelligentTextChunker`. Use when a downstream consumer requires bounded context windows or when feeding large documents into the training generator.

Installation

$ npx skills add smithery/findinfinitelabs --skill intelligent-text-chunking

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/findinfinitelabs.

npx skills add smithery/findinfinitelabs

Browse all from smithery/findinfinitelabs

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,646 B
  • docs SUMMARY.md 297 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Intelligent Text Chunking

There is a real implementation at [src/utils/intelligentchunker.py](../../../src/utils/intelligentchunker.py). Use it; don't roll your own splitter.

API

from src.utils.intelligent_chunker import IntelligentTextChunker, ChunkType, TextChunk

chunker = IntelligentTextChunker(
    max_chunk_size=512,      # tokens/characters per chunk
    min_chunk_size=50,
    overlap_ratio=0.1,       # 0.0–0.5
    preserve_sentences=True,
    preserve_paragraphs=True,
)
chunks: list[TextChunk] = chunker.chunk(text)
# Each TextChunk has: content, start_position, end_position, chunk_id,
#   chunk_type (ChunkType enum), metadata, overlap_with_previous, overlap_with_next

ChunkType enum: SEMANTIC, STRUCTURAL, FIXEDSIZE, SLIDINGWINDOW ([intelligentchunker.py](../../../src/utils/intelligentchunker.py#L16)).

The chunker has built-in awareness of:

  • Multi-language sentence boundaries (English, Chuukese, generic CJK punctuation).
  • Structure markers (markdown headings, list items, dictionary entries, page breaks).
  • Semantic transition phrases (topic change, continuation, conclusion, examples).

Where it's used

  • [EnhancedOCRProcessor](../../../src/ocr/enhancedocrprocessor.py#L102) — chunks OCR output for downstream training/storage.
  • [LargeDocumentProcessor](../../../src/pipeline/largedocumentprocessor.py#L43) — top-level pipeline for 200+ page documents.
  • [AITrainingDataGenerator](../../../src/training/aitraininggenerator.py#L73) consumes chunks indirectly through ParsedDocument.

Critical: scripture references aren't protected

The chunker does not know about Bible references — it will happily split 1 Cor. 13:4-7 across chunks. Always wrap calls with protectscripturereferences / restorescripturereferences from [src/utils/scriptureparser.py](../../../src/utils/scriptureparser.py#L77) when input may contain them. See the [scripture-reference-parsing](../scripture-reference-parsing/SKILL.md) skill.

from src.utils.scripture_parser import (
    protect_scripture_references, restore_scripture_references
)

protected, refs = protect_scripture_references(raw)
chunks = chunker.chunk(protected)
chunks = [
    TextChunk(content=restore_scripture_references(c.content, refs), **c_meta)
    for c in chunks
]

Choosing parameters

Use case maxchunksize overlap_ratio
Training pairs 256–512 0.0–0.05
RAG / retrieval 512–1024 0.10–0.15
Summarization input 1024–2048 0.05

Chuukese text is denser per-character than English — when budgeting tokens for an LLM downstream, count tokens, not characters.

Pitfalls

  • maxchunksize is in characters by default (the dataclass len returns len(content)). If you need token counts, post-process with the model's tokenizer.
  • Setting preserveparagraphs=True plus a small maxchunk_size will produce oversized chunks rather than break a paragraph — verify chunk lengths if you have hard caps.
  • The chunker emits chunk_ids that are not deterministic across runs (they include positional info). Don't use them as DB primary keys.
  • Don't subclass — the public API is small. If you need different behavior, configure the constructor or post-process the chunk list.