Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

table-extraction

БесплатноБез исполняемых скриптовНе проверен

Table extraction from PDFs and images for RAG. Covers Camelot, Tabula, pdfplumber, TableTransformer (DETR), Amazon Textract Tables, Azure Document…

claude-dev-suiteот claude-dev-suite★ 51 звезда на GitHub

Об этом скилле

Table Extraction

Tool Comparison

Tool Input Ruled Tables Borderless Merged Cells Cost
Camelot (lattice) Digital PDF Excellent Poor Partial Free
Camelot (stream) Digital PDF OK OK Poor Free
Tabula Digital PDF Excellent OK Poor Free
pdfplumber Digital PDF Very good Good Partial Free
TableTransformer Image/PDF Excellent Excellent Good GPU time
AWS Textract Tables PDF/image Excellent Excellent Yes Per-page
Azure Doc Intelligence PDF/image Excellent Excellent Yes Per-page

Camelot

import camelot

# Lattice: ruled tables
tables = camelot.read_pdf(
    "report.pdf",
    pages="1-end",
    flavor="lattice",
    line_scale=40,
)

# Stream: whitespace-delimited
tables_stream = camelot.read_pdf(
    "report.pdf",
    pages="1-end",
    flavor="stream",
    edge_tol=500,
    row_tol=10,
)

print(f"Found {tables.n} tables")
for i, t in enumerate(tables):
    print(t.parsing_report)        # accuracy, whitespace, order
    df = t.df                      # pandas DataFrame
    df.to_csv(f"table_{i}.csv", index=False)

Tabula-py

import tabula

dfs = tabula.read_pdf(
    "report.pdf",
    pages="all",
    multiple_tables=True,
    lattice=True,
    pandas_options={"header": 0},
)

tabula.convert_into("report.pdf", "tables.csv", output_format="csv", pages="all")

pdfplumber Tables

import pdfplumber

with pdfplumber.open("report.pdf") as pdf:
    for page_num, page in enumerate(pdf.pages):
        settings = {
            "vertical_strategy": "lines",
            "horizontal_strategy": "lines",
            "snap_tolerance": 3,
            "join_tolerance": 3,
        }
        for table in page.extract_tables(table_settings=settings):
            # table is list[list[str|None]]
            cleaned = [[c or "" for c in row] for row in table]
            print(f"Page {page_num+1}:", cleaned[0])

TableTransformer (Microsoft, DETR-based)

from transformers import AutoImageProcessor, TableTransformerForObjectDetection
from PIL import Image
import torch

processor = AutoImageProcessor.from_pretrained("microsoft/table-transformer-detection")
detector = TableTransformerForObjectDetection.from_pretrained("microsoft/table-transformer-detection")

structure = TableTransformerForObjectDetection.from_pretrained(
    "microsoft/table-transformer-structure-recognition-v1.1-all"
)

image = Image.open("page.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt")

with torch.no_grad():
    outputs = detector(**inputs)

target_sizes = torch.tensor([image.size[::-1]])
results = processor.post_process_object_detection(outputs, threshold=0.9, target_sizes=target_sizes)[0]

for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
    print(detector.config.id2label[label.item()], score.item(), box.tolist())

# Crop detected table and run structure model
x0, y0, x1, y1 = results["boxes"][0].tolist()
table_img = image.crop((x0, y0, x1, y1))
structure_inputs = processor(images=table_img, return_tensors="pt")
with torch.no_grad():
    structure_out = structure(**structure_inputs)

AWS Textract — Tables + Queries

import boto3

client = boto3.client("textract", region_name="us-east-1")

with open("form.pdf", "rb") as f:
    response = client.analyze_document(
        Document={"Bytes": f.read()},
        FeatureTypes=["TABLES", "FORMS"],
    )

# Build cell grid
blocks = {b["Id"]: b for b in response["Blocks"]}
tables = [b for b in response["Blocks"] if b["BlockType"] == "TABLE"]

def cell_text(cell_block):
    out = []
    for rel in cell_block.get("Relationships", []):
        if rel["Type"] == "CHILD":
            for child_id in rel["Ids"]:
                word = blocks[child_id]
                if word["BlockType"] == "WORD":
                    out.append(word["Text"])
    return " ".join(out)

for table in tables:
    cells = []
    for rel in table.get("Relationships", []):
        if rel["Type"] == "CHILD":
            for cid in rel["Ids"]:
                cb = blocks[cid]
                if cb["BlockType"] == "CELL":
                    cells.append({
                        "row": cb["RowIndex"],
                        "col": cb["ColumnIndex"],
                        "row_span": cb.get("RowSpan", 1),
                        "col_span": cb.get("ColumnSpan", 1),
                        "text": cell_text(cb),
                    })
    print(cells[:5])

Textract Queries (ask targeted questions)

response = client.analyze_document(
    Document={"Bytes": pdf_bytes},
    FeatureTypes=["QUERIES"],
    QueriesConfig={"Queries": [
        {"Text": "What is the invoice total?", "Alias": "TOTAL"},
        {"Text": "What is the due date?", "Alias": "DUE_DATE"},
    ]},
)

Azure AI Document Intelligence

f
Полный SKILL.md на GitHub

Установить table-extraction в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Write
Edit

FAQ

Что делает скилл table-extraction?

Table extraction from PDFs and images for RAG. Covers Camelot, Tabula, pdfplumber, TableTransformer (DETR), Amazon Textract Tables, Azure Document Intelligence. Conversion to markdown/CSV/JSON, merged-cell handling. USE WHEN: user mentions "table extraction", "PDF tables", "Camelot", "Tabula", "TableTransformer", "Textract tables", "Azure form recognizer tables", "markdown table for LLM" DO NOT USE FOR: general PDF text - use `pdf-extraction`; full OCR pipelines - use `ocr`

Как установить скилл table-extraction?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл table-extraction запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить table-extraction с