设计与多媒体

sn-da-non-spreadsheet-analysis

试用

Word / PDF / PPT 文档解析与数据分析引擎。覆盖三类文件格式的全量提取、表格数值化、图表理解与跨文档汇总分析。**遇到以下任一情况就主动使用本 skill**:①用户上传或指定了 .docx / .doc / .pdf / .pptx / .ppt 文件并要求分析、提取或统计其中内容;②用户出现触发词:Word分析 / PDF解析 / PPT提取 / 文档分析 / 报告解析 / 幻灯片分析 / 发票提取 / 合同分析 / 文档统计 / 错别字 / 语病 / 字号检查 / 简历分析 / 多文档对比;③任务涉及从文档中提取表格、数值、图表、格式(颜色/高亮/字号)、组织架构、时间线等结构化信息。仅不用于:Excel/CSV 数据分析(使用 sn-da-excel-workflow)、纯图片分析(使用 sn-da-image-caption)。

它能做什么

Word / PDF / PPT 文档解析与数据分析引擎。覆盖三类文件格式的全量提取、表格数值化、图表理解与跨文档汇总分析。**遇到以下任一情况就主动使用本 skill**:①用户上传或指定了 .docx / .doc / .pdf / .pptx / .ppt 文件并要求分析、提取或统计其中内容;②用户出现触发词:Word分析 / PDF解析 / PPT提取 / 文档分析 / 报告解析 / 幻灯片分析 / 发票提取 / 合同分析 / 文档统计 / 错别字 / 语病 / 字号检查 / 简历分析 / 多文档对比;③任务涉及从文档中提取表格、数值、图表、格式(颜色/高亮/字号)、组织架构、时间线等结构化信息。仅不用于:Excel/CSV 数据分析(使用 sn-da-excel-workflow)、纯图片分析(使用 sn-da-image-caption)。

技能文档

Document Analysis Skill — Word / PDF / PPT

End-to-end workflow for Word, PDF, and PPT document parsing. Each format has specific parsing pitfalls — follow the format-specific sub-skill exactly.


Workflow

Step 0 — Identify file type and input scope

import os

input_path = "/mnt/data/..."  # from user

# Detect single file vs directory (multi-file scenario)
if os.path.isdir(input_path):
    all_files = [
        os.path.join(input_path, f)
        for f in os.listdir(input_path)
        if f.lower().endswith(('.docx', '.doc', '.pdf', '.pptx', '.ppt'))
    ]
    print(f"Found {len(all_files)} documents: {all_files}")
else:
    all_files = [input_path]

# Route by extension
ext = os.path.splitext(all_files[0])[-1].lower()
print(f"File type: {ext}")

Critical rule: When input_path is a directory OR the user says "这些文件" / "所有文档", process every file and aggregate. Never stop at the first file.


Step 1 — Load sub-skill by format

ExtensionSub-skill to load
.docx / .doccapability/word-analysis/SKILL.md
.pdfcapability/pdf-analysis/SKILL.md
.pptx / .pptcapability/ppt-analysis/SKILL.md
read_file(path="/sn-da-non-spreadsheet-analysis/capability/-analysis/SKILL.md")

Load only the sub-skill you need — do not load all three at once.


Step 2 — Parse and extract

Follow the sub-skill's extraction pattern. For all formats:

  • Full scan: iterate all pages/slides/paragraphs — never stop early
  • Table extraction: get every table, not just the first one
  • Image/chart detection: if a page/slide yields no text, treat it as image-based and call caption.py

Step 3 — Answer with verification

After extracting data, verify before answering:

# For count/statistics questions: spot-check 3-5 items
sample = result_list[:3]
print(f"Sample check: {sample}")
print(f"Total count: {len(result_list)}")

# For numeric calculations: print intermediate values
print(f"Max={max_val}, Min={min_val}, Range={max_val - min_val}")

# For unit-sensitive answers: always include the unit
print(f"Answer: {value} {unit}")  # e.g., "475 千港元" not just "475"

Universal Rules

MUST DO

  • Always iterate all pages/slides/paragraphsfor page in doc, for slide in prs.slides, for para in doc.paragraphs
  • When input is a directory: collect and process all matching files, then aggregate results
  • For scanned PDFs: detect empty text → call caption.py for OCR
  • For image-only slides: text extraction returns empty → render slide as PNG → call caption.py
  • For calculations: show intermediate values; confirm unit matches the question

NEVER DO

  • Do NOT use pytesseract or easyocr as primary OCR — they are not installed; use caption.py
  • Do NOT use PIL pixel analysis to infer chart values — use vision model caption instead
  • Do NOT stop at the first file, first page, or first table
  • Do NOT guess content from filenames — always parse the actual file
  • Do NOT output percentage when the question asks for absolute value (and vice versa)

Caption Script (for image/chart content in any document)

When a page, slide, or embedded image needs vision understanding, load the sn-da-image-caption skill first, then use its scripts/caption.py:

read_file(path="/sn-da-image-caption/SKILL.md")
import subprocess, json

CAPTION = "/path/to/skills/sn-da-image-caption/scripts/caption.py"

def caption_image(image_path, prompt=None):
    cmd = ["python3", CAPTION, image_path, "--json"]
    if prompt:
        cmd += ["--prompt", prompt]
    result = subprocess.run(cmd, capture_output=True, text=True, timeout=60)
    if result.returncode != 0:
        raise RuntimeError(f"caption failed: {result.stderr[:200]}")
    return json.loads(result.stdout)["description"]

# Example prompts by content type:
# Table:  "提取表格所有内容,Markdown 表格格式,保持行列结构,数值不四舍五入。"
# Chart:  "提取图表标题、坐标轴标签、每个数据点的数值。Markdown 表格输出。"
# Diagram: "描述所有节点和连接关系。"

Available sub-skills

sn-da-non-spreadsheet-analysis/capability/word-analysis/SKILL.md   — .docx/.doc
sn-da-non-spreadsheet-analysis/capability/pdf-analysis/SKILL.md    — .pdf
sn-da-non-spreadsheet-analysis/capability/ppt-analysis/SKILL.md    — .pptx/.ppt

相关技能

Excel 数据分析多步编排器。覆盖:(1) 读取多 Sheet Excel 文件并统计行数,(2) 大文件检测(≥10k 行自动 Parquet 优化),(3) 数据清洗(缺失值、文本标准化、无效字符),(4) 条件筛选与分类提取,(5) 跨 Sheet 统计聚合,(6) 导出 Excel/CSV 并提供下载链接。覆盖从数据读取到报告生成全流程,按步骤编排 capability 子 skill。**遇到以下任一情况就主动使用本 skill,不要自行写几行 pandas 就回答**:①用户出现触发词:Excel 分析 / 表格分析 / 数据分析 / 数据清洗 / 数据统计 / 数据筛选 / 数据可视化 / 数据导出 / 汇总统计 / 透视表 / 分组统计 / 交叉分析 / 趋势分析 / 对比分析 / 异常值检测 / 去重 / 缺失值处理 / Excel 报告 / 生成报表 / analyze Excel / data analysis / data cleaning / pivot table;②用户上传或指定了 .xlsx / .xls / .csv 文件并要求分析、清洗、统计或可视化;③任务涉及多 Sheet 读取、条件筛选、分类汇总、图表生成中的任意一项;④用户要求导出带格式的 Excel 报告或下载链接。仅不用于:不涉及表格数据的纯文本处理、图片分析(使用 sn-da-image-caption)、单个公式计算的简单问答。

万行以上 Excel 数据集的高性能分析引擎。提供 openpyxl read_only 流式读取(iter_rows 支持 10 万行以上)、Parquet 转换加速、内存优化、分块处理和大文件写入模式。**遇到以下任一情况就主动使用本 skill**:①数据行数 ≥ 10k(由 sn-da-excel-workflow 的行数评估步骤触发);②用户出现触发词:大文件 / 大数据量 / 性能优化 / 内存不足 / OOM / 百万行 / 十万行 / 流式读取 / Parquet / 分块处理 / large file / big data / streaming read / chunked processing;③直接使用 pd.read_excel() 导致超时或内存溢出;④用户明确要求对大规模数据集进行高性能处理。仅不用于:小于 10k 行的常规 Excel 分析(使用 sn-da-excel-workflow 即可)。

图片理解与数据提取 skill。当图片文件(.png/.jpg/.jpeg/.gif/.webp/.bmp)是主要输入且用户需要理解、提取数据或分析图片内容时使用。提供预配置的 caption 脚本(scripts/caption.py),通过 vision 模型将图片转为文本描述,无需额外配置 API Key。覆盖:(1) 通过 scripts/caption.py 对图表/表格/截图/流程图进行 caption,(2) 将 caption 文本解析为结构化 DataFrame,(3) 基于提取数据重新生成可视化图表,(4) 导出为 Excel/CSV。**遇到以下任一情况就主动使用本 skill,不要自行猜测图片内容**:①用户出现触发词:图片分析 / 图表提取 / 表格识别 / OCR / 图片描述 / 截图分析 / 图表数据 / 提取图片中的数据 / 图片转表格 / 识别图片 / image caption / extract data from image / chart analysis / table OCR;②用户上传或指定了图片文件(.png / .jpg / .jpeg / .gif / .webp / .bmp)并要求理解、提取数据或分析内容;③任务需要从图表截图、表格截图、UI 截图、流程图中提取结构化信息;④用户要求将图片中的数据转为 Excel/CSV 或重新生成可视化图表。仅不用于:图片编辑(裁剪、滤镜、缩放)、图片生成、不含数据的风景/人物照片描述。

百度智能文档分析(基于百度「智能文档分析」,官网入口:https://ai.baidu.com/tech/nlp/Textanalysis)的 API 调用技能。支持文档抽取、文档解析、文档解析(PaddleOCR-VL)、文档比对、合同审查、文档格式转换等功能。当用户需要:(1) 从文档中提取特定字段信息,(2) 解析文档内容,(3) 比对两份文档差异,(4) 审查合同风险,(5) 转换文档格式时使用此技能。触发词:文档抽取、文档解析、PaddleOCR、文档比对、合同审查、格式转换、智能文档分析、百度智能文档分析、百度文档AI。

17 次安装

PDF 阅读助手技能 v2.0。支持文本提取、表格提取、扫描版OCR识别、智能问答、多文档对比、批量处理。触发词:PDF、阅读PDF、分析PDF、PDF摘要、提取PDF、研报、论文、文档分析。

1 次安装