doc-parser
БесплатноБез исполняемых скриптовНе проверенParse complex documents with IBM's open-source Docling library, which turns PDFs and Office files into structured Markdown or JSON. Use when a user asks to…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Document Parser
Overview
Parse complex documents containing tables, figures, multi-column layouts, headers, and mixed content using the Docling library (originally from IBM Research, now an open-source LF AI & Data project). This skill goes beyond simple text extraction by understanding document structure, detecting layout regions, and preserving the logical reading order across complex formatting.
Instructions
When a user asks to parse a complex document or extract structured content from a document with tables, figures, or multi-column layouts, follow these steps:
Step 1: Install docling
python -m venv .venv && .venv/bin/pip install docling
Docling needs Python 3.10+ and depends on PyTorch. On a Linux machine without a GPU, pip install docling --extra-index-url https://download.pytorch.org/whl/cpu avoids the large CUDA wheels. The first conversion downloads the layout and table models from Hugging Face, so allow time and network access once.
For a quick one-off, the CLI writes Markdown to the output folder (add --to json or --to html for other formats):
.venv/bin/docling Q3-report.pdf --output converted/
Step 2: Load and convert the document
Use DocumentConverter to parse the document. Reuse one converter for many files; creating it is the expensive part.
from docling.document_converter import DocumentConverter
converter = DocumentConverter()
result = converter.convert("paper.pdf") # a local path or an http(s) URL
doc = result.document # a DoclingDocument
Supported inputs include PDF, DOCX, XLSX, PPTX, HTML, Markdown, CSV, EPUB, images (PNG, JPEG, TIFF, BMP, WEBP), and more; the current list is in the "Supported formats" page of the docling documentation. Legacy .doc/.xls/.ppt and RTF need LibreOffice installed. To limit work on a long PDF, pass page_range=(1, 20) to convert().
Step 3: Export to the desired format
Markdown (headings, tables, lists):
markdown = doc.export_to_markdown()
Lossless JSON (the full document tree, reloadable later):
import json
with open("paper.json", "w") as fp:
json.dump(doc.export_to_dict(), fp, indent=2)
doc.save_as_markdown("paper.md"), doc.save_as_json("paper.json") and doc.save_as_html("paper.html") write files directly.
Step 4: Handle specific content types
Tables: pass the document to export_to_dataframe (the argument is required in current versions) and write CSV:
from pathlib import Path
def save_tables(doc, output_dir="tables"):
Path(output_dir).mkdir(exist_ok=True)
for i, table in enumerate(doc.tables, start=1):
df = table.export_to_dataframe(doc=doc)
df.to_csv(f"{output_dir}/table_{i}.csv", index=False)
return len(doc.tables)
Figures: pictures are in doc.pictures. To save the image files, ask the PDF pipeline to keep them:
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption
options = PdfPipelineOptions()
options.images_scale = 2.0 # about 144 DPI
options.generate_picture_images = True
converter = DocumentConverter(format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=options)})
doc = converter.convert("paper.pdf").document
for n, picture in enumerate(doc.pictures, start=1):
page = picture.prov[0].page_no if picture.prov else None
print(n, page, picture.caption_text(doc) or "no caption")
picture.get_image(doc).save(f"figure_{n}.png")
Reading order and sections: for item, level in doc.iterate_items(): walks headings, paragraphs, tables and pictures in reading order.
Scanned pages and images: OCR runs automatically on bitmap content. Pick the language and engine with --ocr-lang / --ocr-engine on the CLI, or PdfPipelineOptions.ocr_options. Use --no-ocr to skip it for born-digital PDFs.
Step 5: Present the results
Format output based on user needs:
- Full document: Markdown export with all content preserved
- Tables only: CSV files or formatted markdown tables
- Summary: Document structure outline with section headings and content types found
- Specific sections: Extract targeted parts by heading or page range
Examples
Example 1: Parse an academic paper
User request: "Parse this research paper and extract all the tables: paper.pdf"
Actions taken:
- Convert paper.pdf using docling
- Identify 4 tables across 12 pages
- Export each table as CSV
Output:
Parsed paper.pdf (12 pages)
Document structure:
- Title: "Machine Learning Approaches for Climate Prediction"
- Sections: Abstract, Introduction, Methods, Results, Discussion, References
- Tables found: 4
- Figures found: 6
Tables extracted:
1. table_1.csv - "Dataset Characteristics" (5 cols, 8 rows) - Page 4
2. ta
Установить doc-parser в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл doc-parser?
Parse complex documents with IBM's open-source Docling library, which turns PDFs and Office files into structured Markdown or JSON. Use when a user asks to parse a document with tables, extract figures from a document, handle multi-column layouts, convert a complex PDF to structured data, extract content from academic papers, or process documents with mixed layouts. Handles tables, figures, headers, footers, and multi-column text.
Как установить скилл doc-parser?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл doc-parser запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic