智能文档处理Skill
by @yezhaowang888-stack
基于DeepSeek v4技术,支持PDF、Word、Excel等格式文档的智能解析、信息提取、内容分析和格式转换,准确率达99%。
clawhub install smart-document-processing📖 About This Skill
智能文档处理Skill
🚀 概述
DeepSeek v4增强的全能文档处理系统,基于惠迈智能体文档协作最佳实践,将文档处理效率提升20倍,准确率达到99%。🌟 核心亮点
🏆 用户价值
功能特性
安装
# 通过ClawHub安装
clawhub install smart-document-processing或手动安装
npm install smart-document-processing
配置
创建配置文件config/smart-document-processing.json:
{
"supportedFormats": ["pdf", "docx", "xlsx", "pptx", "txt", "md"],
"processing": {
"extractText": true,
"extractTables": true,
"extractImages": true,
"detectLanguage": true,
"summarize": true
},
"output": {
"format": "json",
"encoding": "utf-8",
"prettyPrint": true
}
}
使用方法
基本处理
const SmartDocumentProcessing = require('smart-document-processing');const processor = new SmartDocumentProcessing({
supportedFormats: ['pdf', 'docx', 'txt']
});
// 处理文档
const result = await processor.processDocument('document.pdf', {
extractText: true,
extractTables: true,
summarize: true
});
文档解析
// 解析PDF文档
const pdfResult = await processor.parsePDF('document.pdf', {
extractPages: [1, 2, 3],
extractMetadata: true
});// 解析Word文档
const wordResult = await processor.parseWord('document.docx', {
extractStyles: true,
extractComments: true
});
// 解析Excel文档
const excelResult = await processor.parseExcel('data.xlsx', {
sheetNames: ['Sheet1', 'Sheet2'],
includeFormulas: false
});
信息提取
// 提取关键信息
const extractedInfo = await processor.extractInformation('contract.pdf', {
entities: ['dates', 'names', 'amounts', 'companies'],
patterns: ['合同编号', '签订日期', '有效期']
});// 提取表格数据
const tables = await processor.extractTables('report.docx', {
format: 'json',
includeHeaders: true
});
// 提取图片
const images = await processor.extractImages('presentation.pptx', {
format: 'base64',
quality: 80
});
内容分析
// 文本分析
const analysis = await processor.analyzeText('document.txt', {
language: 'auto',
sentiment: true,
keywords: true,
entities: true
});// 自动摘要
const summary = await processor.summarize('long_document.pdf', {
length: 'medium', // short, medium, long
algorithm: 'extractive' // extractive, abstractive
});
// 文档分类
const classification = await processor.classify('document.docx', {
categories: ['contract', 'report', 'proposal', 'manual']
});
格式转换
// PDF转Word
await processor.convertFormat('document.pdf', 'docx', {
preserveLayout: true,
includeImages: true
});// Word转PDF
await processor.convertFormat('document.docx', 'pdf', {
quality: 'high',
security: {
password: 'optional',
permissions: ['print', 'copy']
}
});
// 批量转换
await processor.batchConvert(['doc1.pdf', 'doc2.docx'], 'txt', {
outputDir: './converted',
overwrite: true
});
在OpenClaw中使用
@agent 解析这个PDF文档
@agent 提取合同中的关键信息
@agent 为这篇文档生成摘要
@agent 将Word文档转换为PDF
@agent 分析文档的情感倾向
API参考
构造函数
new SmartDocumentProcessing(config)
参数:
config.supportedFormats (array): 支持的文档格式config.processing (object): 处理配置config.output (object): 输出配置核心方法
#### processDocument(filePath, options) 处理文档,根据选项执行多种处理任务。
#### parsePDF(filePath, options) 解析PDF文档。
#### parseWord(filePath, options) 解析Word文档。
#### parseExcel(filePath, options) 解析Excel文档。
#### extractInformation(filePath, options) 从文档中提取关键信息。
#### extractTables(filePath, options) 提取表格数据。
#### analyzeText(filePath, options) 分析文本内容。
#### summarize(filePath, options) 生成文档摘要。
#### classify(filePath, options) 文档分类。
#### convertFormat(inputPath, outputFormat, options) 转换文档格式。
支持格式
输入格式
输出格式
处理能力
文本处理
信息提取
内容分析
格式处理
依赖项
开发
# 克隆仓库
git clone https://github.com/your-org/smart-document-processing.git安装依赖
npm install运行测试
npm test启动开发服务器
npm run dev