TTokenySpace
返回 Skills 列表

Pdf Rename

Rename academic PDF papers to a standardized format "[Year] [Venue] Title.pdf" using a three-stage pipeline (Extract → Verify → Rename). Use when the user as...

#中文
0

安装到 Tokeny(自动)

下载 ZIP
安装"pdf-rename"技能
技能信息:
- 名称: Pdf Rename
- 标识: pdf-rename
- 描述: Rename academic PDF papers to a standardized format "[Year] [Venue] Title.pdf" using a three-stage pipeline (Extract → Verify → Rename). Use when the user as...
- 版本: 1.0.0
下载地址:
https://www.tokeny.space/api/skills/pdf-rename/download
继续

复制上方内容到 Tokeny 客户端并在会话中发送即可自动安装;也可直接 下载 ZIP并拖动到技能窗口安装。

SKILL.md

PDF Rename — Academic Paper Organizer

Rename academic PDFs to: [Year] [Venue] Title.pdf

Three-stage pipeline:

Extract → Verify → Rename

Anti-error principle: Never re-parse PDF content during Rename. The Manifest is the single source of truth.


Quick Start

# Stage 1: Extract raw text → manifest.json
python scripts/extract.py "<folder_path>"

# Stage 2: LLM parses raw_text → inject verified data → manifest_verified.json
#   (Agent reads manifest.json raw_text field and writes to scripts/VERIFIED_DATA_*.py)
python scripts/apply_verified.py "<folder_path>"

# Stage 3: Preview / Execute
python scripts/execute.py "<folder_path>" --preview
python scripts/execute.py "<folder_path>" --execute

Stage 1: Extract

What it does:

  • Reads first 3 pages of each PDF
  • Stores raw text in manifest.jsonraw_text field
  • Extracts year_hint from filename prefix
  • Detects potential duplicates by filename similarity

Manifest schema — see references/manifest_spec.md


Stage 2: Verify

The agent reads manifest.json, parses each raw_text field, and writes verified metadata.

Steps:

  1. Read manifest.json
  2. For each entry, parse the raw_text to extract: title, authors, venue, year, abstract
  3. Create or update scripts/VERIFIED_DATA_*.py with verified entries

VERIFIED_DATA format:

VERIFIED_DATA = {
    "OriginalFilename.pdf": {
        "title": "Correct Paper Title",
        "year": "2024",
        "venue": "NeurIPS",
        "confirmed": True   # must be True to be renamed
    },
}

Rules:

  • Key must exactly match the original filename
  • confirmed: True → status becomes ready → will be renamed
  • confirmed: False or omitted → skipped
  • Multiple VERIFIED_DATA_*.py files are auto-merged
  • Prefer venue/conference year over filename year (e.g., arXiv 2022 → NeurIPS 2024)

⚠️ Key gotchas during parsing:

  • Multi-line titles: pypdf concatenates lines without spaces (e.g., "Direct score maximization outperformsplanning loss") — use context to infer correct split
  • Journal refs at top of page: "Math. Program. (2012) 133..." is NOT the title — read further
  • arXiv papers: use conference year if published, otherwise use arXiv year
  • Non-paper files (book chapters, lecture notes, loss curves): set confirmed: False and skip

Then run:

python scripts/apply_verified.py "<folder_path>"

Stage 3: Rename

  • Only status == 'ready' files are renamed
  • Duplicate titles → (1), (2) suffixes
  • Backup created at <folder>/_backup_YYYYMMDD_HHMMSS/
python scripts/execute.py "<folder_path>" --preview   # dry run
python scripts/execute.py "<folder_path>" --execute   # rename

Scripts

ScriptPurpose
scripts/extract.pyStage 1: extract raw PDF text → manifest.json
scripts/apply_verified.pyStage 2: inject verified metadata → manifest_verified.json
scripts/execute.pyStage 3: rename files (preview or execute)
scripts/llm_parse.py(Optional) programmatic LLM parsing via gateway API

Known Failure Modes

SymptomCauseFix
raw_text emptyPDF is a scanSkip (confirmed: False) or manually determine metadata
Title extracted without spacespypdf concatenates linesLLM infers from context; use filename as hint
Wrong year (arXiv ≠ conference)Used filename yearUse venue year from raw_text, not filename
DOI/journal ref at top of pageMetadata precedes titleRead past it — title is usually after
Middle-dot author lines misidentified· separator in namesLLM handles via semantic understanding
Non-paper files renamedNo filter appliedSet confirmed: False for non-papers
Windows filename encoding garbledChinese/non-ASCII chars in PowerShellUse Python scripts, not manual file ops
Ligature artifactsPDF encoding (e.g., fi)clean_title_text() in extract.py handles these

References

  • references/manifest_spec.md — Full manifest JSON schema
  • references/venue_abbrev.md — Standard venue abbreviation map

评论

加载中…