Xpersona
P

PDF Processor

CLAWHUB · Unverified

学术PDF处理:提取文字、判断语言、翻译(英文→中文)、生成200字纯中文概述。使用本地Ollama模型,不消耗线上API。适用于学术论文、研究报告等PDF文件的处理。当用户说"处理PDF"、"翻译论文"、"生成论文概述"时,或用户将PDF放入论文处理目录时使用。 Skill: PDF Processor Owner: reaperchen Summary: 学术PDF处理:提取文字、判断语言、翻译(英文→中文)、生成200字纯中文概述。使用本地Ollama模型,不消耗线上API。适用于学术论文、研究报告等PDF文件的处理。当用户说"处理PDF"、"翻译论文"、"生成论文概述"时,或用户将PDF放入论文处理目录时使用。 Tags: latest:2.0.0 Version history: v2.0.0 | 2026-04-04T12:26:28.789Z | user v2.0新功能:实时进度显示、断点续传、索引生成、串行翻译优化 Archive index: Archive v2.0.0: 8 files, 15847 bytes Files: package.json (960b), references/directory-structure.md (3117b), referen

62
Rank
84
Safety
1.3k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17471ykccf99a8tg2rh3bzjzd847z3m:pdf-processor
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-reaperchen-pdf-processor/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

11,312 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: pdf-processor
description: 学术PDF处理:提取文字、判断语言、翻译(英文→中文)、生成200字纯中文概述。使用本地Ollama模型,不消耗线上API。适用于学术论文、研究报告等PDF文件的处理。当用户说"处理PDF"、"翻译论文"、"生成论文概述"时,或用户将PDF放入论文处理目录时使用。
---

# PDF Processor

## Overview

处理学术论文PDF的完整工作流:文字提取、语言判断、翻译、概述生成。使用本地Ollama模型(qwen2.5:7b),成本为0元,适合处理大量学术文献。

**核心功能**:
- 提取PDF全部文字(按页分隔)
- 判断语言(中文/英文)
- 提取和翻译论文标题(英文→中文)
- 英文PDF分段翻译(每段2000字符)
- **实时进度显示**(显示当前段/总段数、百分比)
- **断点续传**(中断后可从断点继续)
- 生成200字纯中文概述
- 自动文件组织和清理

## Quick Start

### 处理单个PDF

```bash
python3 scripts/process_pdf.py <pdf_path> <output_base_dir>
```

**示例**:
```bash
# 处理英文PDF
python3 scripts/process_pdf.py \
  ~/Documents/论文处理/未处理/英文/2602.23362v1.pdf \
  ~/Documents/论文处理

# 处理中文PDF
python3 scripts/process_pdf.py \
  ~/Documents/论文处理/未处理/中文/test.pdf \
  ~/Documents/论文处理
```

### 目录结构

PDF处理前需先创建目录:

```
~/Documents/论文处理/
├── 未处理/
│   ├── 中文/
│   └── 英文/
├── 处理中/
├── 已完成/
│   ├── 原文/
│   ├── 翻译/
│   └── 概述/
└── 索引/
```

详见 [directory-structure.md](references/directory-structure.md)

## Workflow

### 完整处理流程

```
1. PDF提取文字 → 保存到"处理中/文件名_提取.txt"
2. 提取和翻译论文标题(英文→中文)
3. 判断语言(中文/英文)
4. 如果是英文:
   - 分段(每段2000字符)
   - 逐段翻译(本地Ollama)
   - **显示实时进度**(当前段/总段数 | 百分比 | 字符数)
   - **保存进度**(处理中/文件名_progress.json)
   - 合并翻译结果
   - **删除进度文件**
5. 生成概述(200字纯中文,本地Ollama)
6. 保存翻译文件到"已完成/翻译/"
7. 保存概述文件到"已完成/概述/"(包含中英文标题)
8. 移动PDF到"已完成/原文/"
9. 删除"处理中/提取.txt"
```

详细说明见 [workflow.md](references/workflow.md)

### 分段翻译策略

- **分段大小**: 每段最多4000字符
- **分段边界**: 优先在段落边界断开(\n\n\n, \n\n, 。, !, ?)
- **翻译模型**: 本地Ollama (qwen2.5:7b)
- **优势**: 避免长文本处理问题,提高翻译质量

### 概述生成

- **输入**: 前5000字符(摘要和引言)
- **输出**: 200字纯中文
- **内容**: 研究背景、主要方法、核心贡献、应用价值
- **清理**: 移除所有英文、数字、符号

## Technical Details

### 依赖项

- **Python库**: pdfplumber, requests, re, shutil, pathlib
- **Ollama**: qwen2.5:7b模型
- **Ollama服务**: 本地运行在http://localhost:11434

### 性能特点

- **成本**: 0元(本地模型,不消耗线上API)
- **处理时间**:
  - 提取: 秒级
  - 翻译: 每段30秒-1分钟,总时间取决于段数
  - 概述: 秒级
- **质量**:
  - 翻译: 学术准确性高,保持段落结构
  - 概述: 200字纯中文,简洁准确
- **v2.0新功能**:
  - **实时进度显示**: 显示当前段/总段数、百分比、字符数
  - **断点续传**: 中断后可从断点继续,自动跳过已翻译段落
  - **进度保存**: 保存到临时JSON文件,完成后自动删除

### 分段示例

对于45,873字符的PDF:
- 分段数: 17段
- 每段字符数: 2,000-4,000
- 总翻译时间: 约8-17分钟

## Output Files

### 翻译文件

**位置**: `已完成/翻译/文件名_翻译.txt`

**格式**:
```
# 论文翻译

**源文件**: 文件名.pdf
**处理时间**: YYYY-MM-DD HH:MM:SS
**翻译模型**: 本地Ollama (qwen2.5:7b)
**分段数**: N

## 📄 翻译内容

[翻译内容]
```

### 概述文件

**位置**: `已完成/概述/文件名_概述.txt`

**格式**:
```
# 论文概述

**源文件**: 文件名.pdf
**处理时间**: YYYY-MM-DD HH:MM:SS
**概述模型**: 本地Ollama (qwen2.5:7b)

## 📚 论文标题

**英文**: [论文英文标题]
**中文**: [论文中文标题]

## 📝 论文概述

[200字纯中文概述]
```

## Resources

### scripts/

- **process_pdf.py**: 完整的PDF处理脚本(v2.0)
  - 文字提取、语言判断、翻译、概述生成
  - **实时进度显示**(当前段/总段数 | 百分比)
  - **断点续传**(中断后可从断点继续,自动跳过已翻译段落)
  - 自动文件组织和清理
  - 可独立运行或被其他脚本调用

- **generate_index.py**: 索引生成脚本
  - 生成已完成论文的索引文件
  - 包含标题、语言、概述、处理时间
  - 支持关键词搜索

### references/

- **workflow.md**: 完整工作流程说明
  - 关键步骤说明
  - 技术依赖
  - 性能特点

- **directory-structure.md**: 目录结构和使用说明
  - 完整目录树
  - 文件夹用途
  - 文件生命周期

## Troubleshooting

### Ollama服

_meta.json

{
  "ownerId": "kn77q49ztt5gwh8xyncjcfggrn82e18k",
  "slug": "pdf-processor",
  "version": "2.0.0",
  "publishedAt": 1775305588789
}

references/directory-structure.md

# PDF处理目录结构

## 完整目录树

```
~/Documents/论文处理/
│
├── 未处理/
│   ├── 中文/              # 待处理的中文PDF
│   └── 英文/              # 待处理的英文PDF
│
├── 处理中/              # 临时文件,处理完成后删除
│   └── 文件名_提取.txt   # PDF提取的文字
│
├── 已完成/
│   ├── 原文/              # 处理完成的PDF原文
│   ├── 翻译/              # PDF的中文翻译
│   │   └── 文件名_翻译.txt
│   └── 概述/              # PDF的200字纯中文概述
│       └── 文件名_概述.txt
│
└── 索引/                # 论文索引(待开发)
```

## 文件夹说明

### 未处理/

**用途**: 存放待处理的PDF文件

**子文件夹**:
- `中文/`: 中文PDF(不翻译,只生成概述)
- `英文/`: 英文PDF(翻译+生成概述)

**命名规范**:
- 文件名使用原始PDF文件名
- 例如: `2602.23362v1.pdf`

### 处理中/

**用途**: 临时存储提取的文字

**文件**:
- `文件名_提取.txt`: PDF提取的纯文本
- 特点: 处理完成后自动删除

### 已完成/

**用途**: 存放处理完成的文件

**子文件夹**:
- `原文/`: 原始PDF文件(从未处理/移动过来)
- `翻译/`: 中文翻译文件(仅英文PDF)
- `概述/`: 200字纯中文概述(所有PDF)

**文件格式**:
- 翻译文件: `文件名_翻译.txt`
- 概述文件: `文件名_概述.txt`

**文件内容结构**:

**翻译文件**:
```
# 论文翻译

**源文件**: 文件名.pdf
**处理时间**: YYYY-MM-DD HH:MM:SS
**翻译模型**: 本地Ollama (qwen2.5:7b)
**分段数**: N

## 📄 翻译内容

[翻译内容]
```

**概述文件**:
```
# 论文概述

**源文件**: 文件名.pdf
**处理时间**: YYYY-MM-DD HH:MM:SS
**概述模型**: 本地Ollama (qwen2.5:7b)

## 📝 论文概述

[200字纯中文概述]
```

### 索引/

**用途**: 论文索引(待开发功能)

**计划**: 可能包含论文元数据、关键词、分类信息

## 使用流程

### 处理新PDF

1. **上传PDF**:
   - 中文PDF → `~/Documents/论文处理/未处理/中文/`
   - 英文PDF → `~/Documents/论文处理/未处理/英文/`

2. **执行处理**:
   - 运行PDF处理脚本
   - 指定PDF路径和输出目录

3. **查看结果**:
   - 翻译: `~/Documents/论文处理/已完成/翻译/`
   - 概述: `~/Documents/论文处理/已完成/概述/`
   - 原文: `~/Documents/论文处理/已完成/原文/`

### 文件生命周期

```
未处理/文件.pdf
    ↓ [处理脚本]
处理中/文件_提取.txt(临时)
    ↓ [翻译+概述]
已完成/文件_翻译.txt(保存)
已完成/文件_概述.txt(保存)
已完成/文件.pdf(移动)
    ↓ [清理]
处理中/文件_提取.txt(删除)
```

## 注意事项

- **处理中文件夹**: 只包含临时文件,处理完成后自动清空
- **已完成文件夹**: 包含所有处理结果,按类型分类
- **原文文件夹**: 保留原始PDF,方便后续查阅
- **路径权限**: 确保Python脚本有读写权限

references/workflow.md

# PDF处理工作流程

## 完整流程

```
1. 用户将PDF放入"未处理/中文/"或"未处理/英文/"
2. 执行处理脚本
3. PDF提取文字 → 保存到"处理中/文件名_提取.txt"
4. 判断语言(中文/英文)
5. 如果是英文:
   - 分段(每段4000字符)
   - 逐段翻译(本地Ollama)
   - 合并翻译结果
6. 生成概述(200字纯中文,本地Ollama)
7. 保存翻译文件到"已完成/翻译/"
8. 保存概述文件到"已完成/概述/"
9. 移动PDF到"已完成/原文/"
10. 删除"处理中/提取.txt"
```

## 关键步骤说明

### 1. PDF文字提取

- **工具**: pdfplumber (Python库)
- **输出**: 纯文本,保留页面分隔
- **特点**:
  - 提取所有页面文字
  - 保持段落结构
  - 标记页码(--- 第N页 ---)

### 2. 语言判断

- **方法**: 统计英文单词数量
- **阈值**: >100个英文单词 = 英文PDF
- **策略**:
  - 英文PDF → 翻译
  - 中文PDF → 跳过翻译

### 3. 分段翻译(英文PDF)

- **分段策略**: 每段最多4000字符
- **分段边界**: 优先在段落边界断开(\n\n\n, \n\n, 。, !, ?)
- **翻译模型**: 本地Ollama (qwen2.5:7b)
- **翻译策略**:
  - 每段独立翻译
  - 使用temperature=0.3保证准确性
  - 合并所有段落的翻译结果

### 4. 概述生成

- **输入**: 前5000字符(摘要和引言部分)
- **模型**: 本地Ollama (qwen2.5:7b)
- **输出要求**:
  - 纯中文,200字以内
  - 包含:研究背景、主要方法、核心贡献、应用价值
  - 清理所有英文、数字、符号

### 5. 文件组织

```
论文处理/
├── 未处理/
│   ├── 中文/
│   └── 英文/
├── 处理中/
│   └── 文件名_提取.txt(临时)
├── 已完成/
│   ├── 原文/
│   ├── 翻译/
│   │   └── 文件名_翻译.txt
│   └── 概述/
│       └── 文件名_概述.txt
└── 索引/
```

## 技术依赖

- **Python库**: pdfplumber, requests, re, shutil, pathlib
- **Ollama**: qwen2.5:7b模型
- **Ollama配置**: 本地服务运行在http://localhost:11434

## 性能特点

- **成本**: 0元(使用本地模型,不消耗线上API)
- **处理时间**:
  - 提取: 秒级
  - 翻译: 每段30秒-1分钟,总时间取决于段数
  - 概述: 秒级
- **质量**:
  - 翻译: 学术准确性高,保持段落结构
  - 概述: 200字纯中文,简洁准确

skill-card.md

## Description:

PDF Processor extracts text from academic PDFs, detects language, translates English content into Chinese, generates concise Chinese summaries, and organizes outputs using a local Ollama model.

This skill is ready for commercial/non-commercial use.

## Publisher:

[reaperchen](https://clawhub.ai/user/reaperchen)

### License/Terms of Use:

MIT-0

## Use Case:

Developers, researchers, and students use this skill to process academic papers and research reports locally: extract PDF text, translate English papers into Chinese, generate concise Chinese summaries, and create a searchable paper index.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Local PDF contents are sent to an Ollama service on localhost during translation and summary generation.

Mitigation: Use a dedicated local environment, avoid sensitive PDFs on shared machines, and confirm the Ollama service endpoint is local before processing.

Risk: Temporary extraction and progress files can contain document text while processing is in progress.

Mitigation: Run the skill in a controlled processing directory with appropriate file permissions and remove residual temporary files after interrupted runs.

Risk: The original PDF is moved into the completed/original folder as part of normal processing.

Mitigation: Process copies when the original file location must be preserved, or use the documented directory layout so movement is expected.

Risk: The skill can attempt to start the local Ollama service if the required model is unavailable.

Mitigation: Start and monitor Ollama manually in production-like use, and stop the service if it starts unexpectedly.

## Reference(s):

- [PDF Processing Workflow](references/workflow.md)
- [PDF Directory Structure](references/directory-structure.md)
- [Ollama](https://ollama.ai)
- [ClawHub Skill Page](https://clawhub.ai/reaperchen/skills/pdf-processor)

## Skill Output:

**Output Type(s):** [text, markdown, shell commands, configuration, guidance]

**Output Format:** [Markdown guidance with shell commands; generated artifacts include text translations, text summaries, temporary JSON progress files, and a JSON paper index.]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Uses local PDF files and a local Ollama qwen2.5:7b service; English PDFs are translated in segments with resumable progress.]

## Skill Version(s):

2.0.0 (source: evidence release and package.json)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to PDF Processor and adjacent AI workflows.