Toc section parsing

From aifinlab/FinClaw · View interactive version

Toc section parsing is an AI agent skill from the GitHub repository aifinlab/FinClaw. 用于长文档章节树的目录与章节结构解析原子 skill,适用于通用行业文档解析场景。

How to use this skill

Skill file

目录与章节结构解析 Skill

数据来源

本 Skill 支持多种长文档输入格式,核心数据来源包括:

1. 文档类型

2. 文档格式

3. 文档特征

4. 数据格式要求

说明:本 Skill 不包含文档采集功能,需要用户提供长文档文件。建议文档格式规范,以便进行准确的目录和章节结构解析。


功能

本 Skill 提供全面的目录与章节结构解析能力,涵盖多种解析功能:

1. 目录识别

2. 章节识别

3. 章节树构建

4. 章节内容提取

5. 章节导航

6. 高级处理功能


使用示例

输出示例

{
  "source_info": {
    "document_id": "DOC001",
    "document_type": "annual_report",
    "source_file": "annual_report.pdf",
    "page_count": 200
  },
  "table_of_contents": {
    "toc_location": {
      "start_page": 3,
      "end_page": 10
    },
    "toc_items": [
      {
        "level": 1,
        "title": "第一章 公司概况",
        "page": 15,
        "section_id": "SEC001"
      },
      {
        "level": 2,
        "title": "1.1 公司基本信息",
        "page": 15,
        "section_id": "SEC002"
      },
      {
        "level": 1,
        "title": "第二章 财务数据",
        "page": 50,
        "section_id": "SEC003"
      }
    ]
  },
  "section_tree": {
    "root": {
      "section_id": "ROOT",
      "title": "文档根节点",
      "level": 0,
      "children": [
        {
          "section_id": "SEC001",
          "title": "第一章 公司概况",
          "level": 1,
          "page": 15,
          "path": ["第一章 公司概况"],
          "children": [
            {
              "section_id": "SEC002",
              "title": "1.1 公司基本信息",
              "level": 2,
              "page": 15,
              "path": ["第一章 公司概况", "1.1 公司基本信息"],
              "children": []
            }
          ]
        },
        {
          "section_id": "SEC003",
          "title": "第二章 财务数据",
          "level": 1,
          "page": 50,
          "path": ["第二章 财务数据"],
          "children": []
        }
      ]
    }
  },
  "sections": [
    {
      "section_id": "SEC001",
      "title": "第一章 公司概况",
      "level": 1,
      "start_page": 15,
      "end_page": 49,
      "content_preview": "公司概况内容...",
      "keywords": ["公司", "概况", "基本信息"]
    }
  ],
  "statistics": {
    "total_sections": 20,
    "max_level": 3,
    "average_section_length": 10,
    "parsing_confidence": 0.94
  }
}

注意事项与限制

1. 文档格式要求

2. 目录识别准确性

3. 章节识别准确性

4. 章节层级

5. 使用限制


参考资料

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.