闲社服务运行正常AI智能体自动化平台
p

文档数据提取

技能标识:polaris-datainsight-doc-extract

Extract structured data from Office documents (DOCX, PPTX, XLSX, HWP, HWPX) using the Polaris AI DataInsight Doc Extract API. Use when the user wants to parse, analyze, or extract text, tables, charts, images, or shapes from document files. Invoke this skill whenever the user mentions extracting content from Word, PowerPoint, Excel, HWP, or HWPX files, wants to parse document structure, needs to convert document data for RAG pipelines, or asks about reading tables, charts, or text from Office-fo

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

文档数据提取

Polaris AI DataInsight — 文档提取技能

使用 Polaris AI DataInsight 文档提取 API,从 Word、PowerPoint、Excel、HWP 和 HWPX 文件中提取文本、图片、表格、图表、形状、公式等内容,并以结构化的 unifiedSchema JSON 格式返回所有内容。单次 API 调用即可获取完整的文档结构,无需手动解析。



何时使用此技能

  • - 用户需要从 DOCX、PPTX、XLSX、HWP 或 HWPX 文件中提取文本、表格、图表或图片
  • 用户需要了解文档结构(页数、元素类型、位置数据等)
  • 提取的数据将用于 RAG 流水线、数据分析工作流或自动化任务
  • 需要将表格数据转换为 CSV,或将图表数据分解为系列和标签
  • 用户需要解析页眉、页脚、公式或形状等特殊元素

此技能的功能

  1. 1. 身份验证 — 通过 x-po-di-apikey 标头向 Polaris DataInsight API 进行身份验证。
  2. 上传并提取 — 以 multipart/form-data POST 请求发送文件,提取完整的文档结构。
  3. 解析 ZIP 响应 — API 返回 ZIP 文件;解压并加载其中的 unifiedSchema JSON。
  4. 交付结构化数据 — 返回按页面和元素类型(文本、表格、图表、图片、形状、公式等)组织的 JSON。
  5. 支持多种使用模式 — 处理全文提取、表格转 CSV、RAG 分块生成等。

使用方法

前提条件

获取 API 密钥:在 https://datainsight.polarisoffice.com 注册并生成您的 API 密钥。

身份验证:在每个请求中将 API 密钥作为标头包含。

标头: x-po-di-apikey: $POLARISDATAINSIGHTAPI_KEY

设置环境变量:

bash
export POLARISDATAINSIGHTAPI_KEY=your-api-key-here

限制

项目限制
支持的格式HWP、HWPX、DOCX、PPTX、XLSX
最大文件大小
25 MB | | 超时时间 | 10 分钟 | | 速率限制 | 每分钟 10 次请求 |

基本用法

端点:

POST https://datainsight-api.polarisoffice.com/api/v1/datainsight/doc-extract

使用 Python 提取文档:

python
import requests
import json
import zipfile
import io

def extractdocument(filepath: str, api_key: str) -> dict:
with open(file_path, rb) as f:
response = requests.post(
https://datainsight-api.polarisoffice.com/api/v1/datainsight/doc-extract,
headers={x-po-di-apikey: api_key},
files={file: f}
)

if response.status_code != 200:
raise Exception(fAPI 错误: {response.status_code} - {response.text})

# 响应是一个 ZIP 文件
zip_buffer = io.BytesIO(response.content)
with zipfile.ZipFile(zip_buffer) as z:
json_files = [name for name in z.namelist() if name.endswith(.json)]
if json_files:
with z.open(json_files[0]) as jf:
return json.load(jf)

raise Exception(ZIP 中未找到 JSON)

示例用法

import os apikey = os.environ[POLARISDATAINSIGHTAPIKEY] schema = extractdocument(report.docx, apikey) print(f已提取 {schema[totalPages]} 页)

使用 curl 提取:

bash
curl -X POST https://datainsight-api.polarisoffice.com/api/v1/datainsight/doc-extract \
-H x-po-di-apikey: $POLARISDATAINSIGHTAPI_KEY \
-F file=@example.docx \
--output result.zip

unzip result.zip -d result/
cat result/*.json | python -m json.tool



高级用法

响应结构 (unifiedSchema)

根节点:

json
{
docName: sample.docx,
totalPages: 3,
pages: [ ... ]
}

页面 (pages[]):

json
{
pageNum: 1,
pageWidth: 595.3,
pageHeight: 842.0,
extractionSummary: {
text: 5, image: 2, table: 1, chart: 1
},
elements: [ ... ]
}

元素类型 (elements[].type):

类型描述
text文本块
image
图片 |
| table | 表格 |
| chart | 图表 |
| shape | 形状 |
| equation | 公式 |
| header / footer | 页眉 / 页脚 |

通用元素结构:

json
{
type: text,
id: te1,
boundaryBox: { left: 40, top: 80, right: 300, bottom: 120 },
content: { text: 此处为正文内容 }
}

表格内容:

json
{
content: {
html:

...
,
csv: Header1,Header2\nValue1,Value2,
json: [
{
metrics: { rowaddr: 0, coladdr: 0, rowspan: 1, colspan: 1 },
para: [{ content: [{ text: 单元格内容 }] }]
}
]
}
}

图表内容:

json
{
content: {
chart_type: column,
title: 年度销售对比,
xaxislabels: [Q1, Q2, Q3, Q4],
series_names: [2023, 2024],
series_values: [[100, 200, 150, 300], [120, 220, 180, 320]],
csv: Quarter,2023,2024\nQ1,100,120\nQ2,200,220
}
}

使用模式

提取所有文本:

python
def getalltext(schema: dict) -> str:
texts = []
for page in schema.get(pages, []):
for el in page.get(elements, []):
if el[type] == text and el.get(content, {}).get(text):
texts.append(el[content][text])
return \n.join(texts)

提取表格为 CSV:

python
def gettablesas_csv(schema: dict) -> list:
tables = []
for page in schema.get(pages, []):
for el in page.get(elements, []):
if el[type] == table:
csv_data = el.get(content, {}).get(csv, )
if csv_data:
tables.append(csv_data)
return tables

生成 RAG 分块:

python
def makeragchunks(schema: dict) -> list:
chunks = []
doc_name = schema.get(docName, )
for page in schema.get(pages, []):
for el in page.get(elements, []):
text = el.get(content, {}).get(text) or el.get(content, {}).get(csv) or
if text.strip():
chunks.append({
source: doc_name,
page: page[pageNum],
type: el[type],
text: text.strip()
})
return chunks



示例

用户: 从这份 DOCX 报告中提取所有表格数据为 CSV。

输出:

python
import os
schema = extractdocument(report.docx, os.environ[POLARISDATAINSIGHTAPIKEY])
tables = gettablesas_csv(schema)
for i, csv_data in enumerate(tables):
print(f=== 表格 {i+1} ===)
print(csv_data)

=== 表格 1 ===
Quarter,Revenue,Cost
Q1,1200,800
Q2,1500,900

=== 表格 2 ===
Item,Amount
Labor,500
Operations,300

灵感来源: Polaris Office DataInsight API 文档和工作流。



提示

  • - 响应始终是一个 ZIP 文件。不要尝试直接解析 response.content 为 JSON — 先使用 zipfile.ZipFile 解压。
-

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 polaris-datainsight-doc-extract-1776279424 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 polaris-datainsight-doc-extract-1776279424 技能

通过命令行安装

skillhub install polaris-datainsight-doc-extract-1776279424

下载

⬇ 下载 polaris-datainsight-doc-extract v1.0.0(免费)

文件大小: 4.33 KB | 发布时间: 2026-4-16 16:36

v1.0.0 最新 2026-4-16 16:36
Polaris DataInsight Doc Extract 1.0.0 — Initial Release

- Extracts structured data from DOCX, PPTX, XLSX, HWP, and HWPX files using the Polaris AI DataInsight API.
- Supports extracting text, images, tables (with CSV/HTML/JSON), charts (with CSV), shapes, equations, headers, and footers from Office-format documents.
- Returns a unified, page-based JSON schema for all elements, packaged in a ZIP file response.
- Ready for parsing document structure, building RAG pipelines, or automating Office data extraction workflows.
- Includes usage examples in Python and curl; outlines authentication and API key requirements.
- Designed for easy integration and scales for data analysis, document parsing, and content conversion tasks.
返回顶部