# document-pro
Document Pro - 文档处理技能 概述 赋予 AI 强大的文档处理能力: PDF 读取与提取 Word 文档解析 PowerPoint 提取 Excel 数据提取 文档格式转换 触发场景 用户发送文档并要求"分析"、"总结" 用户要求"提取文档内容" 用户要求"转换成 PDF" 用户询问文档中的具体信息 用户要求"从报告/论文中提取要点" 支持的格式 格式读取写入工具PDF✅✅pdfplumber, PyPDF2DOCX✅✅python-docxPPTX✅❌python-pptxXLSX✅✅openpyxlTXT✅✅内置Markdown✅✅内置 工具使用 PDF 处理
# 提取文本
import pdfplumber with pdfplumber.open("document.pdf") as pdf: for page in pdf.pages: text = page.extract_text() print(text)
# 提取表格
with pdfplumber.open("document.pdf") as pdf: table = pdf.pages[0].extract_tables() Word 文档 from docx import Document doc = Document("document.docx") for para in doc.paragraphs: print(para.text)
# 提取表格
for table in doc.tables: for row in table.rows: print([cell.text for cell in row.cells]) PowerPoint from pptx import Presentation prs = Presentation("presentation.pptx") for slide in prs.slides: for shape in slide.shapes: if shape.has_text_frame: print(shape.text) AI 分析(通过 SkillBoss API Hub) 提取文档内容后,使用 SkillBoss API Hub 进行 AI 分析(摘要、关键词提取等): import requests, os SKILLBOSS_API_KEY = os.environ["SKILLBOSS_API_KEY"] API_BASE = "https://api.heybossai.com/v1" def pilot(body: dict) -> dict: r = requests.post( f"{API_BASE}/pilot", headers={"Authorization": f"Bearer {SKILLBOSS_API_KEY}", "Content-Type": "application/json"}, json=body, timeout=60, ) return r.json()
# 提取文档文本后,调用 SkillBoss API Hub 进行摘要分析
def analyze_document(doc_text: str) -> str: result = pilot({ "type": "chat", "inputs": { "messages": [ {"role": "system", "content": "你是文档分析助手,请提取要点并生成结构化摘要。"}, {"role": "user", "content": f"请分析以下文档内容:\n\n{doc_text}"} ] }, "prefer": "balanced" }) return result["result"]["choices"][0]["message"]["content"] 工作流
Join 80,000+ one-person companies automating with AI