Skip to content
Back to skills

Vasp Semparser

ASecurity

Semantics-directed scientific PDF asset parser based on VASP's Semantic-Geometric Decoupling engine. Use when extracting clean, intact figures, tables, captions, structured equations/algorithms, metadata, logos, and QR codes from an academic paper or technical PDF—either as Stage 1 of VASP poster generation or as a standalone high-precision PDF asset extraction tool.

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
ai-agentspythongobashdebugging

Works with

  • cli

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add WTHH031230/VASP --skill vasp-semparser --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vasp Semparser?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vasp Semparser
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wthh031230-vasp-semparser/badge)](https://www.skillsdirectory.com/skills/wthh031230-vasp-semparser)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vasp-semparser
description: >
  Semantics-directed scientific PDF asset parser based on VASP's Semantic-Geometric Decoupling engine.
  Use when extracting clean, intact figures, tables, captions, structured equations/algorithms, metadata,
  logos, and QR codes from an academic paper or technical PDF—either as Stage 1 of VASP poster generation
  or as a standalone high-precision PDF asset extraction tool.
---

# VASP SemParser (Experimental Agent Skill)

Extract intact, lossless visual and structured assets from scientific PDFs using **Semantic-Geometric Decoupling**: you (the agent) perform semantic role classification and visual quality verification, while the bundled deterministic engine performs exact PDF vector/text-bounded region growing (`caption_cut.py`), invariant checking, and Asset Package assembly.

> **Agent Autonomy:** Treat the bundled scripts, schemas, role taxonomy, and defaults as a high-efficiency foundation rather than rigid constraints. If you are unsatisfied with any extracted result, crop, role assignment, script behavior, or default setting—or if the document or user's specific requirements call for something different—you are free to adjust, override, or modify anything directly based on your own judgment.

## Prerequisites

All core engine code is self-contained under `scripts/engine/`. Install Python dependencies if missing:

```bash
pip install -r <skill_dir>/scripts/requirements.txt
```

## End-to-End Workflow

### 1. Prepare Numbered PDF Lines & Geometry Candidates
Run the deterministic PDF pre-parser (add `--include-appendix` if appendix figures are needed):

```bash
python <skill_dir>/scripts/semparser_cli.py prepare \
  --pdf <paper.pdf> \
  --work-dir <work_dir> [--include-appendix]
```

This creates:
- `<work_dir>/semantic/numbered_lines.txt` — every content line `[id] text` grouped by PDF page
- `<work_dir>/semantic/boundary_candidates_compact.json` — detected outer rules/margins per page
- `<work_dir>/semantic/response.schema.json` — exact dynamic JSON Schema for this PDF
- `<work_dir>/text/text.txt` — reading-order plain text

### 2. Perform Semantic Role Assignment & Structured Extraction
Read `<work_dir>/semantic/numbered_lines.txt`, `<work_dir>/semantic/boundary_candidates_compact.json`, and `references/role_assignment_guide.md`.

Write a single JSON file `<work_dir>/semantic/roles_response.json` assigning every line ID `0 .. N-1` to its semantic role (`figure_caption`, `subfig_caption`, `figure_content`, `body`, `heading`, `table_title`, `algorithm`, `equation_caption`, `title_author`, `page_header`, `page_footer`, `footnote`, `page_number`, `other`) along with structured `tables`, `equations`, `algorithms`, `metadata`, and `page_outer_boundaries`.

Validate and publish the semantic artifacts (pass `--viz` to render role overlays for debugging):

```bash
python <skill_dir>/scripts/semparser_cli.py apply-roles \
  --work-dir <work_dir> \
  --response <work_dir>/semantic/roles_response.json [--viz]
```

If validation reports a schema or range issue, fix `<work_dir>/semantic/roles_response.json` and re-run `apply-roles`.

### 3. Run Deterministic Caption-Anchored Region-Growing Cropping
Run the full bundled VASP geometric cropper (`caption_cut.py` with outer-rule, structured-rule, table-band, rendered-text-wall-edge refinement, and R2 invariant checks):

```bash
python <skill_dir>/scripts/semparser_cli.py crop \
  --work-dir <work_dir> [--include-appendix]
```

This outputs:
- `<work_dir>/figures/figures/*.png` — lossless high-DPI cropped figures
- `<work_dir>/figures/crop_contact_sheet.jpg` — labeled visual overview of every crop with PDF bbox and R2 flags
- `<work_dir>/figures/overlay/pageN.png` — full-page red-box crop overlays
- `<work_dir>/figures/report.json` — R2 invariant flags (`I2_overlap`, `I3_swallows_caption`, `I4_raster_uncovered`)

### 4. Visually Inspect & Surgically Repair Edge Cases
**Always visually inspect** `<work_dir>/figures/crop_contact_sheet.jpg` (and individual crops or `<work_dir>/figures/overlay/pageN.png` for any flagged/suspicious figures).

If any crop clips a legend/axis/panel, absorbs neighboring prose, or misses a non-standard visual:
- **Option A (Semantic fix)**: update the misclassified line roles in `<work_dir>/semantic/roles_response.json` (e.g. changing a diagram label from `body` to `figure_content`, or fixing a caption range) and re-run `apply-roles` + `crop`.
- **Option B (Direct lossless PDF recrop)**: inspect the page with a PDF-point coordinate grid and recrop directly at 300 DPI:
  ```bash
  python <skill_dir>/scripts/semparser_cli.py render-page \
    --pdf <work_dir>/input/paper.pdf --page <N> --out <work_dir>/pageN_grid.png --grid 50

  python <skill_dir>/scripts/semparser_cli.py recrop \
    --pdf <work_dir>/input/paper.pdf --page <N> --bbox x0,y0,x1,y1 \
    --out <work_dir>/figures/figures/page2_figure_Figure2.png \
    --work-dir <work_dir> --label "Figure 2"
  ```
- **Option C (Custom adaptation)**: modify any bundled script or produce custom extracted assets directly if the PDF uses an unusual layout (slides, multi-page spreads, scanned pages, non-academic reports).

### 5. Assemble the Standardized VASP Asset Package
Package crops, captions, enriched metadata, logos, QR codes, text, and structured tables/equations/algorithms (see `references/asset_package_spec.md`):

```bash
python <skill_dir>/scripts/semparser_cli.py package \
  --work-dir <work_dir> \
  --out <asset_dir> [--include-appendix] [--skip-enrich] [--skip-logos] [--skip-qr]
```

Pass `<asset_dir>` directly to `vasp-viscomposer` (or hand the extracted assets directly to the user).

Files in this skill

  • SKILL.md5.5 KB
  • references/asset_package_spec.md1.7 KB
  • references/role_assignment_guide.md4.4 KB
  • schemas/semantic_roles_template.json14.5 KB
  • scripts/engine/bundle/build_package.py27.6 KB
  • scripts/engine/captions/extract_captions.py13.9 KB
  • scripts/engine/extract/caption_cut/caption_cut.py76.8 KB
  • scripts/engine/extract/caption_cut/deterministic_table_bands.py12.7 KB
  • scripts/engine/extract/caption_cut/outer_rule_candidates.py14.6 KB
  • scripts/engine/extract/caption_cut/segment_roles.py26.4 KB
  • scripts/engine/extract/caption_cut/semantic_prompt.py4.2 KB
  • scripts/engine/extract/caption_cut/semantic_schema.py6.6 KB
  • scripts/engine/extract/caption_cut/semantic_validation.py5.4 KB
  • scripts/engine/extract/caption_cut/structured_rule_candidates.py13.1 KB
  • scripts/engine/extract/textgap.py20.8 KB
  • scripts/engine/family_interface.py3 KB
  • scripts/engine/logos/fetch_logos.py18.6 KB
  • scripts/engine/metadata/enrich_metadata.py13.8 KB
  • scripts/engine/metadata/extract_metadata.py5.4 KB
  • scripts/engine/qr/make_qr.py9.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.