Relation extraction

From aifinlab/FinClaw · View interactive version

Relation extraction 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": "announcement",
    "source_file": "announcement.pdf"
  },
  "relations": [
    {
      "relation_id": "REL001",
      "relation_type": "shareholding",
      "relation_subtype": "direct_holding",
      "source_entity": {
        "type": "company",
        "name": "公司A",
        "normalized_name": "公司A股份有限公司"
      },
      "target_entity": {
        "type": "company",
        "name": "公司B",
        "normalized_name": "公司B股份有限公司"
      },
      "relation_properties": {
        "shareholding_ratio": 30.5,
        "shareholding_amount": 100000000,
        "shareholding_type": "流通股",
        "start_date": "2020-01-15",
        "end_date": null
      },
      "relation_description": "公司A持有公司B 30.5%的股份",
      "confidence": 0.95,
      "evidence": "根据公告,公司A持有公司B 30.5%的股份",
      "status": "active"
    },
    {
      "relation_id": "REL002",
      "relation_type": "guarantee",
      "relation_subtype": "guarantee_obligation",
      "source_entity": {
        "type": "company",
        "name": "公司C",
        "normalized_name": "公司C股份有限公司"
      },
      "target_entity": {
        "type": "company",
        "name": "公司D",
        "normalized_name": "公司D股份有限公司"
      },
      "relation_properties": {
        "guarantee_amount": 50000000,
        "guarantee_type": "连带责任保证",
        "start_date": "2023-06-01",
        "end_date": "2025-06-01"
      },
      "relation_description": "公司C为公司D提供5000万元连带责任保证",
      "confidence": 0.92,
      "evidence": "根据担保合同,公司C为公司D提供5000万元连带责任保证",
      "status": "active"
    }
  ],
  "relation_network": {
    "nodes": [
      {"id": "公司A", "type": "company"},
      {"id": "公司B", "type": "company"},
      {"id": "公司C", "type": "company"},
      {"id": "公司D", "type": "company"}
    ],
    "edges": [
      {
        "source": "公司A",
        "target": "公司B",
        "relation_type": "shareholding",
        "weight": 30.5
      },
      {
        "source": "公司C",
        "target": "公司D",
        "relation_type": "guarantee",
        "weight": 50000000
      }
    ]
  },
  "statistics": {
    "total_relations": 2,
    "relation_types": ["shareholding", "guarantee"],
    "entity_count": 4
  }
}

注意事项与限制

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.