Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

feat: 迁移预设模板到legacy目录并更新结构

yifanfeng97bcc64983089b
diff --git a/examples/life_event_timeline_demo.py b/examples/life_event_timeline_demo.py
new file mode 100644
index 0000000..7acec33
--- /dev/null
+++ b/examples/life_event_timeline_demo.py
@@ -0,0 +1,169 @@
+"""
+Life Event Timeline 知识模板测试演示
+
+这个文件用于测试 hyperextract 中 life_event_timeline 知识模板。
+使用祖冲之传记作为输入数据,实现提取、问答、搜索和可视化功能。
+
+使用方法:
+python examples/life_event_timeline_demo.py
+"""
+
+import os
+import sys
+
+# Add project root to path
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+from pathlib import Path
+from dotenv import load_dotenv
+
+# 导入必要的模块
+from hyperextract.utils.template_engine import Template, Gallery
+from langchain_openai import ChatOpenAI, OpenAIEmbeddings
+
+
+# ==========================================
+# 配置
+# ==========================================
+
+# 模板文件路径
+TEMPLATE_FILE = Path(__file__).parent.parent / "hyperextract" / "templates" / "presets" / "general" / "life_event_timeline.yaml"
+
+# 输入文件路径
+INPUT_FILE = Path(__file__).parent.parent / "tests" / "test_data" / "templates" / "biography_scientist.md"
+
+
+def main():
+ """
+ 主函数:执行知识提取、问答、搜索和可视化流程
+ """
+ print("=" * 60)
+ print("Life Event Timeline 知识模板测试演示")
+ print("=" * 60)
+
+ # 加载环境变量
+ load_dotenv()
+
+ # 验证文件是否存在
+ if not TEMPLATE_FILE.exists():
+ print(f"❌ 错误:找不到模板文件 {TEMPLATE_FILE}")
+ return
+
+ if not INPUT_FILE.exists():
+ print(f"❌ 错误:找不到输入文件 {INPUT_FILE}")
+ return
+
+ print(f"\n📄 输入文件: {INPUT_FILE.name}")
+ print(f"🎯 使用模板: life_event_timeline.yaml")
+
+ # 初始化 LLM 客户端
+ print("\n🔧 初始化 LLM 客户端...")
+ try:
+ llm = ChatOpenAI(
+ model="gpt-4o-mini",
+ temperature=0,
+ )
+ embedder = OpenAIEmbeddings(model="text-embedding-3-small")
+ print("✅ LLM 客户端初始化成功")
+ except Exception as e:
+ print(f"❌ LLM 客户端初始化失败: {e}")
+ print("💡 请确保您已经正确设置了 OPENAI_API_KEY 环境变量")
+ return
+
+ # 读取输入文件内容
+ print("\n📖 读取文件内容...")
+ with open(INPUT_FILE, "r", encoding="utf-8") as f:
+ content = f.read()
+ print(f"✅ 读取成功,共 {len(content)} 字符")
+
+ # 初始化模板并进行知识提取
+ print("\n🧠 开始知识提取...")
+ try:
+ # 添加自定义模板文件到 Gallery
+ Gallery.add(str(TEMPLATE_FILE))
+ print("✅ 模板文件添加成功")
+
+ # 从模板名称创建模板实例
+ template = Template.create(
+ "LifeEventTimeline",
+ llm_client=llm,
+ embedder=embedder,
+ observation_time="2026-03-14"
+ )
+ print("✅ 模板初始化成功")
+
+ # 喂入文本
+ template.feed_text(content)
+ print("✅ 知识提取完成")
+
+ # 构建索引
+ template.build_index()
+ print("✅ 索引构建完成")
+
+ # 展示提取结果
+ print("\n" + "=" * 60)
+ print("📊 提取结果展示")
+ print("=" * 60)
+ template.show()
+
+ # 问答功能
+ print("\n" + "=" * 60)
+ print("❓ 问答功能测试")
+ print("=" * 60)
+ questions = [
+ "祖冲之出生于哪一年?",
+ "祖冲之在数学方面有什么成就?",
+ "《大明历》是在哪一年编成的?",
+ "祖冲之发明了哪些机械装置?",
+ "祖冲之去世于哪一年?"
+ ]
+
+ for question in questions:
+ print(f"\n问题: {question}")
+ try:
+ answer = template.ask(question)
+ print(f"回答: {answer}")
+ except Exception as e:
+ print(f"❌ 问答失败: {e}")
+
+ # 搜索功能
+ print("\n" + "=" * 60)
+ print("🔍 搜索功能测试")
+ print("=" * 60)
+ search_queries = [
+ "圆周率",
+ "大明历",
+ "指南车",
+ "462年"
+ ]
+
+ for query in search_queries:
+ print(f"\n搜索: {query}")
+ try:
+ results = template.search(query, k=3)
+ print(f"找到 {len(results)} 个结果:")
+ for i, result in enumerate(results, 1):
+ print(f" {i}. {result['content'][:100]}...")
+ except Exception as e:
+ print(f"❌ 搜索失败: {e}")
+
+ # 可视化功能
+ print("\n" + "=" * 60)
+ print("📈 可视化功能测试")
+ print("=" * 60)
+ try:
+ # 生成可视化
+ visualization = template.visualize()
+ print("✅ 可视化生成成功")
+ print("\n提示: 可视化结果已保存到临时文件")
+ except Exception as e:
+ print(f"❌ 可视化失败: {e}")
+
+ except Exception as e:
+ print(f"❌ 知识提取失败: {e}")
+ import traceback
+ traceback.print_exc()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/hyperextract/templates/legacy/presets/finance/call_sentiment_hypergraph.yaml b/hyperextract/templates/legacy/presets/finance/call_sentiment_hypergraph.yaml
new file mode 100644
index 0000000..fffcc93
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/call_sentiment_hypergraph.yaml
@@ -0,0 +1,107 @@
+language: zh
+name: CallSentimentHypergraph
+type: hypergraph
+tags:
+- finance
+description:
+ zh: 电话会议情绪超图 - 从财报电话会议中提取多维情绪聚类
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 主题元素名称(例如'收入增长'、'CEO 蒂姆·库克'、'AI 投资周期'、'谨慎')
+ required: true
+ default: ''
+ - name: element_type
+ type: string
+ description:
+ zh: 类型:主题、发言人、情绪、驱动因素
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 该元素的上下文或说明
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: cluster_name
+ type: string
+ description:
+ zh: 描述性名称(例如'CEO 看好 AI 收入'、'CFO 对利润率持谨慎态度')
+ required: true
+ default: ''
+ - name: participating_elements
+ type: array
+ description:
+ zh: 此情绪聚类中所有元素的名称(主题 + 发言人 + 情绪 + 驱动因素)
+ required: true
+ default: ''
+ - name: sentiment_polarity
+ type: string
+ description:
+ zh: 整体情绪方向:看多、看空、中性、混合
+ required: true
+ default: ''
+ - name: intensity
+ type: string
+ description:
+ zh: 情绪强度:强、中等、轻微
+ required: true
+ default: ''
+ - name: evidence
+ type: string
+ description:
+ zh: 支持情绪判断的关键引述或意译
+ required: false
+ default: ''
+ - name: shift_from_prior
+ type: string
+ description:
+ zh: 与前一季度基调的变化(如显著,例如'比第二季度更为谨慎'、'从中性上调')
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的财报电话会议情绪分析师,请从文本中提取主题、发言人、情绪信号及其多维关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别讨论的关键主题(收入、利润率、指引、战略)
+ - 识别发言人及其角色
+ - 评估每个主题-发言人组合的情绪方向和强度
+ - 超边连接 主题 + 发言人 + 情绪 + 驱动因素
+ - 记录与前一季度基调的变化
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别讨论的财务主题
+ - 识别发言人(分析师、管理层)
+ - 识别情绪标签和驱动因素
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 每个聚类连接 主题 + 发言人 + 情绪 + 驱动因素
+ - 评估整体情绪方向和强度
+ - 捕捉支撑证据
+ - 记录与前几个季度的基调变化
+identifiers:
+ entity_id: name
+ relation_id: '{cluster_name}|{participating_elements}'
+ relation_members: participating_elements
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} [{element_type}]'
+ relation_label: '{cluster_name}'
diff --git a/hyperextract/templates/legacy/presets/finance/company_history_timeline.yaml b/hyperextract/templates/legacy/presets/finance/company_history_timeline.yaml
new file mode 100644
index 0000000..73c8f7a
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/company_history_timeline.yaml
@@ -0,0 +1,115 @@
+language: zh
+name: CompanyHistoryTimeline
+type: temporal_graph
+tags:
+- finance
+description:
+ zh: 公司历史时间线 - 从招股说明书或公司历史文档中提取里程碑事件
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称
+ required: true
+ default: ''
+ - name: type
+ type: string
+ description:
+ zh: 实体类型:公司、创始人、投资机构等
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 事件主体/相关实体
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 事件对象/相关实体
+ required: true
+ default: ''
+ - name: eventType
+ type: string
+ description:
+ zh: 事件类型:成立、融资、并购、IPO、裁员、发布产品、管理层变更、股权变更、获得专利、获奖
+ required: true
+ default: ''
+ - name: eventDate
+ type: string
+ description:
+ zh: 事件日期,格式为年-月-日或年份
+ required: false
+ default: ''
+ - name: details
+ type: string
+ description:
+ zh: 事件详细描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的公司历史分析师,请从文本中提取公司相关的实体以及里程碑事件。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建新的实体
+ - 关系描述应与原文保持一致
+ - 仅提取与公司历史直接相关的核心实体
+ - 重点关注:本公司、子公司、创始人、投资机构
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅提取与公司历史直接相关的核心实体
+ - 重点关注:本公司、子公司、创始人、投资机构
+ - 实体类型:公司、创始人、投资机构
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取事件,不要创建未列出的实体
+ - 时间信息为可选,仅在文本中明确提及时才提取
+ - source 和 target 只能是单个实体,不能是多个实体的拼接
+ - 如果多个主体参与同一事件,应为每个主体创建独立的边
+ - 事件类型:成立、融资、并购、IPO、裁员、发布产品、管理层变更、股权变更、获得专利、获奖
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期):
+ - '- "去年" → {observation_time} 前一年'
+ - '- "今年" → {observation_time} 所属年份'
+ - '- "明年" → {observation_time} 后一年'
+ - '- "五年前" → {observation_time} 前五年'
+ - '- "最近" → {observation_time} 前1年'
+ - 明确日期:保持原格式
+ - '- 年份(如 2015年)→ 2015'
+ - '- 年-月-日 → 保持原格式'
+ - 缺失时间:留空
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{eventType}|{details}'
+ relation_members:
+ source: source
+ target: target
+ time_field: eventDate
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({type})'
+ relation_label: '{eventType} ({eventDate})'
diff --git a/hyperextract/templates/legacy/presets/finance/discussion_graph.yaml b/hyperextract/templates/legacy/presets/finance/discussion_graph.yaml
new file mode 100644
index 0000000..c60346f
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/discussion_graph.yaml
@@ -0,0 +1,93 @@
+language: zh
+name: DiscussionGraph
+type: graph
+tags:
+- finance
+description:
+ zh: 财报会议讨论图谱 - 从财报电话会议中提取实体及关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称
+ required: true
+ default: ''
+ - name: type
+ type: string
+ description:
+ zh: 实体类型:参会人员、公司、产品、指标、行业
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 实体描述/说明
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体
+ required: true
+ default: ''
+ - name: relation_type
+ type: string
+ description:
+ zh: 关系类型
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的财报会议分析师,请从文本中提取讨论中出现的实体以及它们之间的关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体
+ - 实体名称与原文保持一致
+ - 参会人员是核心,必须提取
+ - 实体类型:参会人员(分析师、管理层)、公司、产品、指标、行业等
+ - 关系类型:参会人员之间(提问、回答、追问、澄清、反问等)、参会人员与其他实体(提问关于、回答关于、看好、看衰、担忧、质疑等)、其他实体之间(竞争、合作、增长、下降等)
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将其合并为一个节点
+ - 实体名称与原文保持一致
+ - 参会人员:分析师、管理层(CEO、CFO等)
+ - 公司、产品、指标、行业
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 参会人员之间:提问、回答、追问、澄清、反问等
+ - 参会人员与其他实体:提问关于、回答关于、看好、看衰、担忧、质疑、主导、负责等
+ - 其他实体之间:竞争、合作、增长、下降等
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relation_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({type})'
+ relation_label: '{relation_type}'
diff --git a/hyperextract/templates/legacy/presets/finance/earnings_call_summary.yaml b/hyperextract/templates/legacy/presets/finance/earnings_call_summary.yaml
new file mode 100644
index 0000000..35d0042
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/earnings_call_summary.yaml
@@ -0,0 +1,122 @@
+language: zh
+name: EarningsCallSummary
+type: model
+tags:
+- finance
+description:
+ zh: 财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标、业绩指引和整体基调
+output:
+ description: {}
+ fields:
+ - name: company_name
+ type: string
+ description:
+ zh: 公司名称
+ required: false
+ default: ''
+ - name: ticker
+ type: string
+ description:
+ zh: 股票代码
+ required: false
+ default: ''
+ - name: quarter
+ type: string
+ description:
+ zh: 报告季度(例如'Q3 FY2024'、'2024 年第四季度')
+ required: false
+ default: ''
+ - name: call_date
+ type: string
+ description:
+ zh: 财报电话会议日期
+ required: false
+ default: ''
+ - name: reported_revenue
+ type: string
+ description:
+ zh: 本季度报告收入(例如'948 亿美元')
+ required: false
+ default: ''
+ - name: revenue_vs_consensus
+ type: string
+ description:
+ zh: 收入与市场一致预期对比(例如'超出 12 亿美元'、'符合预期'、'低于预期 5 亿美元')
+ required: false
+ default: ''
+ - name: reported_eps
+ type: string
+ description:
+ zh: 报告的稀释每股收益(例如'1.46 美元')
+ required: false
+ default: ''
+ - name: eps_vs_consensus
+ type: string
+ description:
+ zh: 每股收益与一致预期对比(例如'超出 0.05 美元')
+ required: false
+ default: ''
+ - name: guidance_revenue
+ type: string
+ description:
+ zh: 前瞻性收入指引(例如'第四季度 950-970 亿美元'、'2025 财年收入 3800-3900 亿美元')
+ required: false
+ default: ''
+ - name: guidance_eps
+ type: string
+ description:
+ zh: 前瞻性每股收益指引(如有提供)
+ required: false
+ default: ''
+ - name: overall_tone
+ type: string
+ description:
+ zh: 电话会议整体基调:'积极'、'审慎乐观'、'中性'、'谨慎'、'消极'
+ required: false
+ default: ''
+ - name: key_highlights
+ type: array
+ description:
+ zh: 管理层准备发言中的 3-5 项核心亮点
+ required: false
+ default: ''
+ - name: key_concerns
+ type: array
+ description:
+ zh: 管理层或分析师在问答环节提出的主要关切
+ required: false
+ default: ''
+ - name: strategic_priorities
+ type: array
+ description:
+ zh: 管理层强调的战略重点
+ required: false
+ default: ''
+ - name: ceo_name
+ type: string
+ description:
+ zh: CEO 或主要发言人姓名
+ required: false
+ default: ''
+ - name: cfo_name
+ type: string
+ description:
+ zh: CFO 姓名
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的分析师,请从财报电话会议记录中提取关键财务指标、业绩指引和整体基调。
+
+ '
+ rules:
+ zh:
+ - 每个对象对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 提取确切的报告数据(收入、每股收益)并与一致预期进行对比
+ - 捕捉收入和盈利的前瞻性指引
+ - 评估电话会议的整体基调(管理层措辞、分析师反应)
+ - 列出准备发言中的核心亮点和问答环节中的主要关切
+ - 识别管理层强调的战略重点
+display:
+ label: '{company_name} - {quarter}'
diff --git a/hyperextract/templates/legacy/presets/finance/factor_influence_hypergraph.yaml b/hyperextract/templates/legacy/presets/finance/factor_influence_hypergraph.yaml
new file mode 100644
index 0000000..f76f5a5
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/factor_influence_hypergraph.yaml
@@ -0,0 +1,85 @@
+language: zh
+name: FactorInfluenceHypergraph
+type: hypergraph
+tags:
+- finance
+description:
+ zh: 因子影响超图 - 建模股票分析中的多因子关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 因子名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 因子类别:宏观、行业、公司、市场情绪
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 因子描述/说明
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: result
+ type: string
+ description:
+ zh: 结果/影响,如'业绩下滑'、'估值提升'、'价格上涨',不超过10字
+ required: true
+ default: ''
+ - name: factors
+ type: array
+ description:
+ zh: 导致该结果的因子列表(至少2个)
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的金融多因子分析师,请从文本中提取因子(作为节点)和因子导致的结果(作为超边)。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的因子,禁止将多个因子合并为一个节点
+ - 因子名称与原文保持一致
+ - 每条超边必须连接2个或以上因子
+ - 优先提取包含3个及以上因子的超边
+ - 因子类别:宏观(GDP增速、CPI、PPI、利率、汇率等)、行业(景气度、政策、供需格局等)、公司(营收、ROE、PE、净利润等)、市场情绪(资金流向、风险偏好等)
+ - 结果类型:业绩类(业绩下滑、业绩增长、盈利提升等)、估值类(估值提升、估值承压、市值增长等)、价格类(价格上涨、股价下跌、成本上升等)、需求类(需求旺盛、需求疲软、订单增加等)
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的因子,禁止将多个因子合并为一个节点
+ - 因子名称与原文保持一致
+ - 因子类别:宏观(GDP、CPI、利率、汇率等)、行业(景气度、政策、供需等)、公司(营收、ROE、PE等)、市场情绪(资金流向、风险偏好等)
+ rules_for_relations:
+ zh:
+ - 仅从已知因子列表中提取超边,不要创建未列出的因子
+ - 每条超边必须连接至少2个因子
+ - 优先提取包含3个及以上因子的超边
+ - 结果描述不超过10字
+ - 结果类型:业绩类、估值类、价格类、需求类
+identifiers:
+ entity_id: name
+ relation_id: '{result}_{factors}'
+ relation_members: factors
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{result}'
diff --git a/hyperextract/templates/legacy/presets/finance/filing_financial_snapshot.yaml b/hyperextract/templates/legacy/presets/finance/filing_financial_snapshot.yaml
new file mode 100644
index 0000000..b1b9f7f
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/filing_financial_snapshot.yaml
@@ -0,0 +1,104 @@
+language: zh
+name: FilingFinancialSnapshot
+type: model
+tags:
+- finance
+description:
+ zh: 财报财务快照 - 从 SEC 申报文件中提取关键财务数据
+output:
+ description: {}
+ fields:
+ - name: company_name
+ type: string
+ description:
+ zh: 申报实体的法定名称
+ required: false
+ default: ''
+ - name: ticker
+ type: string
+ description:
+ zh: 股票代码(例如 'AAPL'、'MSFT')
+ required: false
+ default: ''
+ - name: filing_type
+ type: string
+ description:
+ zh: 申报类型:'10-K'、'10-Q'、'8-K'、'20-F'
+ required: false
+ default: ''
+ - name: filing_period
+ type: string
+ description:
+ zh: 涵盖的财务期间(例如 'FY2024'、'Q3 2024')
+ required: false
+ default: ''
+ - name: revenue
+ type: string
+ description:
+ zh: 总营收或净销售额(例如 '3943亿美元')
+ required: false
+ default: ''
+ - name: net_income
+ type: string
+ description:
+ zh: 净利润
+ required: false
+ default: ''
+ - name: earnings_per_share
+ type: string
+ description:
+ zh: 稀释每股收益(例如 '$6.13')
+ required: false
+ default: ''
+ - name: total_assets
+ type: string
+ description:
+ zh: 总资产
+ required: false
+ default: ''
+ - name: total_liabilities
+ type: string
+ description:
+ zh: 总负债
+ required: false
+ default: ''
+ - name: shareholders_equity
+ type: string
+ description:
+ zh: 股东权益
+ required: false
+ default: ''
+ - name: operating_cash_flow
+ type: string
+ description:
+ zh: 经营活动现金流
+ required: false
+ default: ''
+ - name: free_cash_flow
+ type: string
+ description:
+ zh: 自由现金流
+ required: false
+ default: ''
+ - name: key_metrics
+ type: array
+ description:
+ zh: 其他关键财务指标列表(如毛利率、ROE、市盈率等)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的财务分析师,请从 SEC 申报文件中提取关键财务数据。
+
+ '
+ rules:
+ zh:
+ - 每个对象对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 按报告原文提取精确的金额数据,保留单位(百万、十亿)
+ - 识别申报实体、股票代码、申报类型和财务期间
+ - 在可获取时同时提取最近期间和前期对比数据
+ - 捕获申报文件中明确列出的关键财务比率
+ - 使用表格中的精确数据;除非文件明确给出,否则不要计算衍生数值
+display:
+ label: '{company_name} ({ticker}) - {filing_period}'
diff --git a/hyperextract/templates/legacy/presets/finance/filing_risk_factor_set.yaml b/hyperextract/templates/legacy/presets/finance/filing_risk_factor_set.yaml
new file mode 100644
index 0000000..b7038ca
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/filing_risk_factor_set.yaml
@@ -0,0 +1,69 @@
+language: zh
+name: FilingRiskFactorSet
+type: set
+tags:
+- finance
+description:
+ zh: 申报风险因素集 - 对 SEC 申报文件中的风险因素进行去重和归类
+output:
+ description: {}
+ fields:
+ - name: risk_title
+ type: string
+ description:
+ zh: 风险因素的简明标题(例如 '网络安全漏洞风险'、'外汇敞口')
+ required: true
+ default: ''
+ - name: risk_category
+ type: string
+ description:
+ zh: 类别:'市场'、'运营'、'监管'、'财务'、'战略'、'网络安全'、'ESG'、'法律'、'地缘政治'
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 申报文件中披露的风险完整描述
+ required: true
+ default: ''
+ - name: potential_impact
+ type: string
+ description:
+ zh: 所述的潜在财务或运营影响(例如 '对营收产生重大不利影响')
+ required: false
+ default: ''
+ - name: affected_areas
+ type: array
+ description:
+ zh: 受影响的业务板块或职能(例如 ['国际业务', '供应链'])
+ required: false
+ default: ''
+ - name: mitigation_disclosed
+ type: string
+ description:
+ zh: 公司已披露的任何缓解措施或管控手段
+ required: false
+ default: ''
+ - name: is_new
+ type: bool
+ description:
+ zh: 与前期申报相比,该风险因素是否为新增
+ required: false
+ default: false
+guideline:
+ target:
+ zh: '你是一位专业的监管申报分析师,请从 SEC 申报文件的风险因素章节中提取并归类所有单项风险因素。
+
+ '
+ rules:
+ zh:
+ - 每个元素对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 规范化:将相关的风险描述归纳到一个简明的风险标题下
+ - 分类:将每项风险归入其主要类别
+ - 完整性:提取每一个不同的风险因素,即使只是简要提及
+ - 累积合并:如果同一风险在不同章节中出现了更多细节,则合并相关信息
+identifiers:
+ item_id: risk_title
+display:
+ label: '[{risk_category}] {risk_title}'
diff --git a/hyperextract/templates/legacy/presets/finance/financial_data_temporal_graph.yaml b/hyperextract/templates/legacy/presets/finance/financial_data_temporal_graph.yaml
new file mode 100644
index 0000000..18e1d4a
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/financial_data_temporal_graph.yaml
@@ -0,0 +1,117 @@
+language: zh
+name: FinancialDataTemporalGraph
+type: temporal_graph
+tags:
+- finance
+description:
+ zh: 财务数据时序图谱 - 跨报告期追踪财务指标变化
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体的规范名称(例如 '苹果公司'、'云服务分部'、'营业收入'、'净利润')
+ required: true
+ default: ''
+ - name: entity_type
+ type: string
+ description:
+ zh: 类型:'公司'、'分部'、'财务指标'、'会计科目'、'外部因素'
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要背景说明(例如 '消费电子业务板块'、'GAAP 收入确认口径')
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 主体(公司/分部/指标名称)
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标(指标/分部/因素名称)
+ required: true
+ default: ''
+ - name: relationship
+ type: string
+ description:
+ zh: 关系类型:'拥有'、'同比变化'、'占比'、'贡献'、'影响'
+ required: true
+ default: ''
+ - name: value
+ type: string
+ description:
+ zh: 数值(如 '3943亿美元'、'+7.8%'、'30%')
+ required: false
+ default: ''
+ - name: fiscal_period
+ type: string
+ description:
+ zh: 财务期间(如 'FY2024'、'Q3 2024')
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的财务分析师,请从文本中提取财务实体及其跨时间的量化关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 将公司、业务分部和财务指标/会计科目识别为实体
+ - 对每个报告数据,创建连接报告主体与指标的边,附带精确数值和财务期间
+ - 将同比变化、衍生比率和分部贡献分别作为独立的边提取
+ - 保留源文本中的精确金额和单位
+ - 统一使用一致的财务期间标签(例如 'FY2024'、'Q3 2024')
+ rules_for_entities:
+ zh:
+ - 每个节点对应一个独立实体
+ - 实体名称与原文保持一致
+ - 提取的节点名称要完整准确,因为边会引用这些名称
+ - 公司:申报公司及其重要子公司
+ - 分部:业务分部或区域(具体名称)
+ - 财务指标:关键财务指标(营业收入、净利润、毛利率等)
+ - 会计科目:主要会计科目
+ - 外部因素:影响财务的外部因素
+ rules_for_relations:
+ zh:
+ - source 和 target 都必须是已知实体列表中的节点
+ - 每个出现的财务数据都必须提取为一条边
+ - 节点名称必须完全匹配
+ - 关系类型:拥有、同比变化、占比、贡献、影响
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期):
+ - '- "去年" → {observation_time} 的前一年'
+ - '- "上月" → {observation_time} 的前一个月'
+ - '- "本季度" → {observation_time} 所在季度'
+ - '- "FY2024" → 2024财年'
+ - 精确时间 → 保持原样
+ - 时间缺失 → 留空,不要猜测
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationship}|{target}'
+ relation_members:
+ source: source
+ target: target
+ time_field: fiscal_period
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({entity_type})'
+ relation_label: '{relationship} ({value})'
diff --git a/hyperextract/templates/legacy/presets/finance/financial_forecast.yaml b/hyperextract/templates/legacy/presets/finance/financial_forecast.yaml
new file mode 100644
index 0000000..04dfdd8
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/financial_forecast.yaml
@@ -0,0 +1,73 @@
+language: zh
+name: FinancialForecast
+type: list
+tags:
+- finance
+description:
+ zh: 财务预测 - 从股票研究报告中提取预测财务数据
+output:
+ description: {}
+ fields:
+ - name: metric
+ type: string
+ description:
+ zh: 被预测的财务指标(例如 '收入'、'每股收益'、'EBITDA'、'营业利润率'、'自由现金流')
+ required: true
+ default: ''
+ - name: period
+ type: string
+ description:
+ zh: 预测期间(例如 'FY2025E'、'Q1 2025E'、'CY2026E')
+ required: true
+ default: ''
+ - name: estimate
+ type: string
+ description:
+ zh: 预测值(例如 '$120.5B'、'$6.25'、'35.2%')
+ required: true
+ default: ''
+ - name: prior_estimate
+ type: string
+ description:
+ zh: 如有修订,之前的预测值(例如 '$115.0B')
+ required: false
+ default: ''
+ - name: consensus
+ type: string
+ description:
+ zh: 用于对比的市场一致性预期(例如 '$118.2B')
+ required: false
+ default: ''
+ - name: growth_rate
+ type: string
+ description:
+ zh: 隐含增长率(例如 '同比+15%'、'持平')
+ required: false
+ default: ''
+ - name: assumptions
+ type: string
+ description:
+ zh: 预测所依据的关键假设(例如 '假设销量增加 500 万台')
+ required: false
+ default: ''
+ - name: source_firm
+ type: string
+ description:
+ zh: 提供该预测的研究机构
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的金融分析师,请从文本中提取所有财务预测和估算。
+
+ '
+ rules:
+ zh:
+ - 每个条目对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 提取每个预测指标及其对应的具体时间段
+ - 在注明修订时,同时捕获当前和之前的预测值
+ - 在进行对比时提取一致性预期
+ - 捕获增长率和关键假设
+display:
+ label: '{metric} ({period}): {estimate}'
diff --git a/hyperextract/templates/legacy/presets/finance/management_guidance_list.yaml b/hyperextract/templates/legacy/presets/finance/management_guidance_list.yaml
new file mode 100644
index 0000000..6c62fd1
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/management_guidance_list.yaml
@@ -0,0 +1,74 @@
+language: zh
+name: ManagementGuidanceList
+type: list
+tags:
+- finance
+description:
+ zh: 管理层业绩指引列表 - 从财报电话会议中提取管理层未来业绩指引
+output:
+ description: {}
+ fields:
+ - name: guidance_topic
+ type: string
+ description:
+ zh: 指引主题(例如'第四季度收入'、'2025 财年资本支出'、'毛利率展望'、'招聘计划')
+ required: true
+ default: ''
+ - name: guidance_type
+ type: string
+ description:
+ zh: 类型:定量、定性、战略、运营
+ required: true
+ default: ''
+ - name: guidance_value
+ type: string
+ description:
+ zh: 指引内容或预测值(例如'950-970 亿美元'、'将拓展 5 个新市场'、'预计下半年利润率改善')
+ required: true
+ default: ''
+ - name: prior_guidance
+ type: string
+ description:
+ zh: 同一指标的前次指引(如有修订,例如'900-930 亿美元')
+ required: false
+ default: ''
+ - name: direction
+ type: string
+ description:
+ zh: 相对前次指引或一致预期的方向:'上调'、'下调'、'维持'、'首次发布'
+ required: false
+ default: ''
+ - name: time_period
+ type: string
+ description:
+ zh: 指引覆盖的时间段(例如'2024 年第四季度'、'2025 财年'、'未来 12 个月')
+ required: false
+ default: ''
+ - name: confidence_language
+ type: string
+ description:
+ zh: 管理层的确信程度措辞(例如'我们预计'、'我们有信心'、'我们预期')
+ required: false
+ default: ''
+ - name: speaker
+ type: string
+ description:
+ zh: 指引发布者(例如'CEO'、'CFO'、'COO')
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的分析师,请从财报电话会议记录中提取所有前瞻性声明和业绩指引。
+
+ '
+ rules:
+ zh:
+ - 每个条目对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 提取每一项指引条目(定量数据、战略规划、展望声明)
+ - 注明指引相较前次是上调、下调还是维持不变
+ - 捕捉每项指引覆盖的时间段
+ - 保留管理层的确信程度措辞
+ - 识别每项指引的发布者
+display:
+ label: '{guidance_topic} [{direction}]: {guidance_value}'
diff --git a/hyperextract/templates/legacy/presets/finance/market_narrative_timeline.yaml b/hyperextract/templates/legacy/presets/finance/market_narrative_timeline.yaml
new file mode 100644
index 0000000..24aae1e
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/market_narrative_timeline.yaml
@@ -0,0 +1,111 @@
+language: zh
+name: MarketNarrativeTimeline
+type: temporal_graph
+tags:
+- finance
+description:
+ zh: 市场叙事时间线 - 追踪市场叙事随时间的演变
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 叙事名称(如'通胀恐惧'、'软着陆希望')
+ required: true
+ default: ''
+ - name: narrative_type
+ type: string
+ description:
+ zh: 叙事类型:'市场情绪'、'投资主题'、'政策预期'、'经济判断'
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 叙事描述
+ required: true
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 先前叙事名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 新兴叙事名称
+ required: true
+ default: ''
+ - name: transition_type
+ type: string
+ description:
+ zh: 演变类型:被替代、演变为、触发了、主导了
+ required: true
+ default: ''
+ - name: timestamp
+ type: string
+ description:
+ zh: 演变时间(如'2024-03'、'2024年Q2')
+ required: true
+ default: ''
+ - name: catalyst
+ type: string
+ description:
+ zh: 触发演变的事件或数据点
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的策略师,请从财经评论中提取市场叙事以及它们随时间的演变。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的叙事,禁止将多个叙事合并为一个节点
+ - 叙事名称与原文保持一致
+ - 仅从已知叙事列表中提取边,不要创建新的叙事
+ - 关系描述应与原文保持一致
+ - 叙事是市场中的"故事"、主题、情绪
+ - 叙事不是具体的公司、指数、政策本身
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的叙事,禁止将多个叙事合并为一个节点
+ - 叙事名称与原文保持一致
+ - 叙事是市场中的"故事"、主题、情绪
+ - 叙事不是具体的公司、指数、政策本身
+ - 叙事类型:市场情绪、投资主题、政策预期、经济判断
+ rules_for_relations:
+ zh:
+ - 边的 source 和 target 必须完全使用下方叙事列表中的名称,禁止创造新叙事
+ - 仅从已知叙事列表中提取边,不要创建新的叙事
+ - 关系描述应与原文保持一致
+ - 演变类型:被替代、演变为、触发了、主导了
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期):
+ - '- "去年" → {observation_time} 的前一年'
+ - '- "上月" → {observation_time} 的前一个月'
+ - '- "本季度" → {observation_time} 所在季度'
+ - '- "近期" → {observation_time} 最近 3 个月'
+ - 精确时间 → 保持原样
+ - 时间缺失 → 留空
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{transition_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+ time_field: timestamp
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({narrative_type})'
+ relation_label: '{transition_type} [{timestamp}]'
diff --git a/hyperextract/templates/legacy/presets/finance/market_sentiment_model.yaml b/hyperextract/templates/legacy/presets/finance/market_sentiment_model.yaml
new file mode 100644
index 0000000..72c487d
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/market_sentiment_model.yaml
@@ -0,0 +1,92 @@
+language: zh
+name: MarketSentimentModel
+type: model
+tags:
+- finance
+description:
+ zh: 市场情绪模型 - 从财经新闻中提取情绪极性、提及实体和预期价格影响
+output:
+ description: {}
+ fields:
+ - name: headline
+ type: string
+ description:
+ zh: 新闻文章/评论的标题/主题
+ required: true
+ default: ''
+ - name: source
+ type: string
+ description:
+ zh: 出版物或来源(例如 '彭博社'、'路透社'、'CNBC')
+ required: false
+ default: ''
+ - name: publication_date
+ type: string
+ description:
+ zh: 发布日期
+ required: false
+ default: ''
+ - name: overall_sentiment
+ type: string
+ description:
+ zh: 整体情绪:看涨、看跌、中性、混合
+ required: false
+ default: ''
+ - name: sentiment_confidence
+ type: string
+ description:
+ zh: 情绪评估的置信度:高、中、低
+ required: false
+ default: ''
+ - name: mentioned_tickers
+ type: array
+ description:
+ zh: 提及的股票代码(例如 ['AAPL', 'MSFT', 'GOOGL'])
+ required: false
+ default: ''
+ - name: mentioned_sectors
+ type: array
+ description:
+ zh: 涉及的行业板块(例如 ['科技', '金融', '能源'])
+ required: false
+ default: ''
+ - name: key_events
+ type: array
+ description:
+ zh: 驱动情绪的关键事件(例如 ['美联储利率决议', 'NVDA 财报超预期'])
+ required: false
+ default: ''
+ - name: expected_impact
+ type: string
+ description:
+ zh: 预期的价格/市场影响(例如 '科技股短期上行'、'板块轮动可能性大')
+ required: false
+ default: ''
+ - name: time_horizon
+ type: string
+ description:
+ zh: 隐含时间范围:'盘中'、'短期'、'中期'、'长期'
+ required: false
+ default: ''
+ - name: contrarian_signals
+ type: array
+ description:
+ zh: 任何逆向或不同意见的观点
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的金融情绪分析师,请从财经新闻文章或市场评论中提取情绪快照。
+
+ '
+ rules:
+ zh:
+ - 每个对象对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 判断整体情绪极性(看涨/看跌/中性/混合)
+ - 识别所有提及的股票代码和行业板块
+ - 提取驱动情绪的关键事件
+ - 评估预期市场影响和时间范围
+ - 记录任何逆向或不同意见的观点
+display:
+ label: '{headline}'
diff --git a/hyperextract/templates/legacy/presets/finance/material_event_timeline.yaml b/hyperextract/templates/legacy/presets/finance/material_event_timeline.yaml
new file mode 100644
index 0000000..87e0d5f
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/material_event_timeline.yaml
@@ -0,0 +1,127 @@
+language: zh
+name: MaterialEventTimeline
+type: temporal_graph
+tags:
+- finance
+description:
+ zh: 重大事件时间线 - 从 8-K 申报文件中按时间顺序提取重大事件
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(例如 公司名称、高管姓名、监管机构)
+ required: true
+ default: ''
+ - name: entity_type
+ type: string
+ description:
+ zh: 类型:'公司'、'高管'、'监管机构'、'交易对手'、'子公司'、'审计师'
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 角色或背景(例如 '首席执行官'、'收购方'、'SEC')
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 行为实体名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 受影响实体名称
+ required: true
+ default: ''
+ - name: event_type
+ type: string
+ description:
+ zh: 类型:'高管任命'、'高管离职'、'收购'、'资产剥离'、'财务重述'、'破产'、'退市'、'重大协议'、'股息宣派'、'股票拆分'、'监管行动'
+ required: true
+ default: ''
+ - name: start_timestamp
+ type: string
+ description:
+ zh: 事件发生或公告的日期(例如 '2024-03-15'、'2024年3月15日')
+ required: false
+ default: ''
+ - name: end_timestamp
+ type: string
+ description:
+ zh: 如适用的结束日期(例如 生效日期、交割日期)
+ required: false
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 重大事件的详细信息,包括财务条款、条件或监管背景
+ required: false
+ default: ''
+ - name: sec_item
+ type: string
+ description:
+ zh: 8-K 条目编号(例如 'Item 5.02'、'Item 1.01'、'Item 2.01')
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的监管申报分析师,请从文本中提取参与重大事件的实体及其之间的时序关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别涉及的公司、高管、监管机构和交易对手
+ - 提取每个重大事件及其具体日期
+ - 在可获取时按 8-K 条目编号对事件进行分类
+ - 捕获财务条款、条件和监管背景
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别公司、高管、监管机构、审计师和交易对手
+ - 按类型对每个实体进行分类
+ - 捕获角色描述
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 通过重大事件连接实体
+ - 提取每个事件的具体日期
+ - 按事件类型和 8-K 条目编号进行分类
+ - 捕获财务条款和条件
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期):
+ - '- "去年" → {observation_time} 的前一年'
+ - '- "上月" → {observation_time} 的前一个月'
+ - '- "本季度" → {observation_time} 所在季度'
+ - '- "近期" → {observation_time} 最近 3 个月'
+ - 精确时间 → 保持原样
+ - 时间缺失 → 留空,不要猜测
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{event_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+ time_field: start_timestamp
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({entity_type})'
+ relation_label: '{event_type} [{start_timestamp}]'
diff --git a/hyperextract/templates/legacy/presets/finance/multi_source_sentiment_hypergraph.yaml b/hyperextract/templates/legacy/presets/finance/multi_source_sentiment_hypergraph.yaml
new file mode 100644
index 0000000..a2a0b9d
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/multi_source_sentiment_hypergraph.yaml
@@ -0,0 +1,119 @@
+language: zh
+name: MultiSourceSentimentHypergraph
+type: hypergraph
+tags:
+- finance
+description:
+ zh: 多源情绪超图 - 整合多个来源的情绪信号
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 来源或实体的名称(例如:'彭博社文章'、'高盛分析师报告'、'AAPL'、'科技板块')
+ required: true
+ default: ''
+ - name: source_type
+ type: string
+ description:
+ zh: 类型:'新闻文章'、'分析师报告'、'社交媒体'、'市场数据'、'公司公告'、'受影响实体'、'板块'、'指数'
+ required: true
+ default: ''
+ - name: sentiment_signal
+ type: string
+ description:
+ zh: 该来源的个别情绪:'看涨'、'看跌'、'中性'
+ required: false
+ default: ''
+ - name: credibility
+ type: string
+ description:
+ zh: 来源可信度评估:'一级'、'二级'、'未验证'
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: fusion_name
+ type: string
+ description:
+ zh: 描述性名称(例如:'AAPL 来自 3 个来源的看涨共识')
+ required: true
+ default: ''
+ - name: participating_sources
+ type: array
+ description:
+ zh: 参与此融合的所有来源和受影响实体的名称
+ required: true
+ default: ''
+ - name: aggregated_polarity
+ type: string
+ description:
+ zh: 融合情绪:'强烈看涨'、'看涨'、'中性'、'看跌'、'强烈看跌'、'冲突'
+ required: true
+ default: ''
+ - name: agreement_level
+ type: string
+ description:
+ zh: 来源一致性:'一致'、'多数'、'分裂'、'矛盾'
+ required: true
+ default: ''
+ - name: affected_entity
+ type: string
+ description:
+ zh: 情绪适用的主要实体(股票代码或板块)
+ required: false
+ default: ''
+ - name: signal_strength
+ type: string
+ description:
+ zh: 交易用的整体信号强度:'可操作'、'参考性'、'噪音'
+ required: false
+ default: ''
+ - name: conflicting_views
+ type: string
+ description:
+ zh: 任何不同或冲突的情绪信号摘要
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的多源情绪融合分析师,请从不同来源提取情绪信号并创建聚合情绪视图。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别每个不同的情绪来源(新闻、分析师报告、社交媒体)
+ - 提取每个来源的个别情绪信号
+ - 创建连接来源到受影响实体的聚合情绪超边
+ - 评估各来源之间的一致性
+ - 记录冲突观点和信号强度
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别新闻文章、分析师报告和社交媒体帖子
+ - 识别受影响实体(股票代码、板块、指数)
+ - 捕捉每个来源的个别情绪
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 每条超边连接多个来源到一个受影响实体
+ - 评估聚合情绪极性和一致性水平
+ - 评估交易用途的信号强度
+ - 记录任何冲突观点
+identifiers:
+ entity_id: name
+ relation_id: fusion_name
+ relation_members: participating_sources
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({source_type})'
+ relation_label: '{fusion_name}'
diff --git a/hyperextract/templates/legacy/presets/finance/proceeds_usage.yaml b/hyperextract/templates/legacy/presets/finance/proceeds_usage.yaml
new file mode 100644
index 0000000..b095a59
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/proceeds_usage.yaml
@@ -0,0 +1,61 @@
+language: zh
+name: ProceedsUsage
+type: list
+tags:
+- finance
+description:
+ zh: 募集资金用途列表 - 从 IPO 招股说明书中提取募集资金分配计划
+output:
+ description: {}
+ fields:
+ - name: use_category
+ type: string
+ description:
+ zh: 资金用途类别(例如'研发投入'、'偿还债务'、'营运资金'、'收购'、'资本支出'、'一般企业用途')
+ required: true
+ default: ''
+ - name: project_name
+ type: string
+ description:
+ zh: 具体项目或计划名称(例如'弗吉尼亚新数据中心'、'平台 2.0 开发')
+ required: false
+ default: ''
+ - name: allocated_amount
+ type: string
+ description:
+ zh: 分配金额(例如'1.5 亿美元'、'约占净募集资金的 30%')
+ required: false
+ default: ''
+ - name: percentage_of_proceeds
+ type: string
+ description:
+ zh: 占总募集资金的百分比(例如'30%'、'约三分之一')
+ required: false
+ default: ''
+ - name: timeline
+ type: string
+ description:
+ zh: 预计资金使用时间表(例如'12-18 个月'、'2025-2026 财年')
+ required: false
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 资金具体使用方式的详细说明
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的 IPO 分析师,请从招股说明书中提取所有募集资金用途分配信息。
+
+ '
+ rules:
+ zh:
+ - 每个条目对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 提取每一项资金用途类别和具体项目
+ - 捕捉分配金额和百分比
+ - 提取资金使用时间表(如有说明)
+ - 保留资金使用方式的详细描述
+display:
+ label: '{use_category}: {allocated_amount}'
diff --git a/hyperextract/templates/legacy/presets/finance/research_note_summary.yaml b/hyperextract/templates/legacy/presets/finance/research_note_summary.yaml
new file mode 100644
index 0000000..f1a13fb
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/research_note_summary.yaml
@@ -0,0 +1,116 @@
+language: zh
+name: ResearchNoteSummary
+type: model
+tags:
+- finance
+description:
+ zh: 研究报告摘要 - 从股票研究报告中提取核心投资论点
+output:
+ description: {}
+ fields:
+ - name: company_name
+ type: string
+ description:
+ zh: 被覆盖公司的名称
+ required: false
+ default: ''
+ - name: ticker
+ type: string
+ description:
+ zh: 股票代码(例如 'AAPL'、'NVDA')
+ required: false
+ default: ''
+ - name: analyst_name
+ type: string
+ description:
+ zh: 首席分析师的姓名
+ required: false
+ default: ''
+ - name: research_firm
+ type: string
+ description:
+ zh: 研究机构名称(例如 '高盛'、'摩根士丹利')
+ required: false
+ default: ''
+ - name: report_date
+ type: string
+ description:
+ zh: 报告发布日期
+ required: false
+ default: ''
+ - name: rating
+ type: string
+ description:
+ zh: 分析师评级:'买入'、'增持'、'持有'、'中性'、'卖出'、'减持'
+ required: false
+ default: ''
+ - name: prior_rating
+ type: string
+ description:
+ zh: 如有变更,之前的评级
+ required: false
+ default: ''
+ - name: target_price
+ type: string
+ description:
+ zh: 当前目标价(例如 '$150.00')
+ required: false
+ default: ''
+ - name: prior_target_price
+ type: string
+ description:
+ zh: 如有变更,之前的目标价
+ required: false
+ default: ''
+ - name: current_price
+ type: string
+ description:
+ zh: 报告发布时的股价
+ required: false
+ default: ''
+ - name: investment_thesis
+ type: string
+ description:
+ zh: 核心投资论点或评级的关键论据
+ required: false
+ default: ''
+ - name: key_catalysts
+ type: array
+ description:
+ zh: 已识别的近期催化剂(例如 ['Q4 业绩超预期', '新产品发布', '监管审批'])
+ required: false
+ default: ''
+ - name: key_risks
+ type: array
+ description:
+ zh: 分析师强调的主要风险
+ required: false
+ default: ''
+ - name: revenue_estimate
+ type: string
+ description:
+ zh: 分析师对当前/下一财年的收入预测
+ required: false
+ default: ''
+ - name: eps_estimate
+ type: string
+ description:
+ zh: 分析师对当前/下一财年的每股收益预测
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的股票研究分析师,请从研究报告中提取核心投资论点、评级、目标价和关键论据。
+
+ '
+ rules:
+ zh:
+ - 每个对象对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 提取分析师的评级及任何评级变更
+ - 捕获目标价以及变更前的目标价(如有变更)
+ - 简洁地总结核心投资论点
+ - 列出分析师识别的关键催化剂和风险
+ - 在提及时提取财务预测(收入、每股收益)
+display:
+ label: '{ticker} - {rating} (目标价: {target_price})'
diff --git a/hyperextract/templates/legacy/presets/finance/risk_assessment.yaml b/hyperextract/templates/legacy/presets/finance/risk_assessment.yaml
new file mode 100644
index 0000000..a7b3a44
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/risk_assessment.yaml
@@ -0,0 +1,121 @@
+language: zh
+name: RiskAssessmentGraph
+type: graph
+tags:
+- finance
+description:
+ zh: 风险评估图谱 - 从企业披露文件中提取风险因子及其财务影响传导路径
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 实体类别:'风险因素'、'财务指标'、'运营结果'
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 实体的详细描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体名称
+ required: true
+ default: ''
+ - name: relation_type
+ type: string
+ description:
+ zh: 关系类型:'导致'、'影响'、'提高'、'降低'、'改善'、'削弱' 等
+ required: true
+ default: ''
+ - name: transmission_mechanism
+ type: string
+ description:
+ zh: 传导机制说明
+ required: true
+ default: ''
+ - name: likelihood
+ type: string
+ description:
+ zh: 发生可能性:高/中/低
+ required: true
+ default: ''
+ - name: severity
+ type: string
+ description:
+ zh: 影响严重程度:高/中/低,或量化影响
+ required: false
+ default: ''
+ - name: mitigation
+ type: string
+ description:
+ zh: 缓解措施或应对策略
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的金融风险分析师,请从企业披露文件中提取风险因素、财务指标、运营结果等实体,以及它们之间的风险传导关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别风险因素:运营风险、市场风险、财务风险、合规风险、外部风险
+ - 识别财务指标:营收、利润、毛利率、现金流等
+ - 识别运营结果:产能利用率、交付周期、客户流失率等
+ - 映射风险到财务影响的传导路径
+ - 提取发生可能性和影响严重程度
+ - 捕获管理层提及的缓解措施
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别风险因素:供应链中断、原材料价格波动、汇率变动等
+ - 识别财务指标:营业收入、净利润、毛利率、现金流等
+ - 识别运营结果:产能利用率、交付延迟、客户流失等
+ - 为每个实体标注正确的类别
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 边的 source 和 target 必须完全使用下方实体列表中的名称,不能创造新名称
+ - 源实体通常是风险因素,目标实体是受影响的财务指标或运营结果
+ - 描述风险传导到目标的机制(如何影响)
+ - 提取发生可能性(高/中/低)
+ - 提取影响严重程度或量化影响
+ - 捕获提及的缓解措施或应对策略
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relation_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relation_type}'
diff --git a/hyperextract/templates/legacy/presets/finance/risk_factor_list.yaml b/hyperextract/templates/legacy/presets/finance/risk_factor_list.yaml
new file mode 100644
index 0000000..943b6a5
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/risk_factor_list.yaml
@@ -0,0 +1,61 @@
+language: zh
+name: RiskFactorList
+type: list
+tags:
+- finance
+description:
+ zh: 风险因素列表 - 从股票研究报告中提取下行风险
+output:
+ description: {}
+ fields:
+ - name: risk_name
+ type: string
+ description:
+ zh: 风险的简洁名称(例如 '欧盟监管收紧'、'强势美元带来的汇率逆风')
+ required: true
+ default: ''
+ - name: risk_category
+ type: string
+ description:
+ zh: 类别:'监管'、'竞争'、'宏观经济'、'运营'、'汇率/货币'、'地缘政治'、'技术'、'法律/诉讼'、'ESG'、'执行'
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 风险情景的详细描述
+ required: true
+ default: ''
+ - name: potential_impact
+ type: string
+ description:
+ zh: 估计的财务影响(例如 '收入下行 3-5%'、'每股收益风险 $0.50')
+ required: false
+ default: ''
+ - name: probability
+ type: string
+ description:
+ zh: 分析师的概率评估:'高'、'中等'、'低'
+ required: false
+ default: ''
+ - name: time_horizon
+ type: string
+ description:
+ zh: 风险可能兑现的时间(例如 '近期'、'2025 年'、'12-18 个月')
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的风险分析师,请从文本中提取所有下行风险和风险因素。
+
+ '
+ rules:
+ zh:
+ - 每个条目对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 提取每一个不同的风险因素
+ - 对每项风险进行适当分类
+ - 在提供量化影响估算时予以捕获
+ - 记录概率评估和时间范围
+display:
+ label: '[{risk_category}] {risk_name}'
diff --git a/hyperextract/templates/legacy/presets/finance/segment_performance_list.yaml b/hyperextract/templates/legacy/presets/finance/segment_performance_list.yaml
new file mode 100644
index 0000000..e7b875a
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/segment_performance_list.yaml
@@ -0,0 +1,67 @@
+language: zh
+name: SegmentPerformanceList
+type: list
+tags:
+- finance
+description:
+ zh: 业务板块业绩列表 - 按业务板块提取营收和关键指标
+output:
+ description: {}
+ fields:
+ - name: segment_name
+ type: string
+ description:
+ zh: 业务板块或地理区域名称(例如 '美洲'、'云服务'、'iPhone')
+ required: true
+ default: ''
+ - name: segment_type
+ type: string
+ description:
+ zh: 类型:'业务板块'、'地理区域'、'产品线'、'经营分部'
+ required: true
+ default: ''
+ - name: revenue
+ type: string
+ description:
+ zh: 该期间的板块营收(例如 '482亿美元')
+ required: false
+ default: ''
+ - name: operating_income
+ type: string
+ description:
+ zh: 板块营业利润或经营利润
+ required: false
+ default: ''
+ - name: revenue_growth
+ type: string
+ description:
+ zh: 同比或环比营收增长率(例如 '+12%'、'-3% 同比')
+ required: false
+ default: ''
+ - name: key_metrics
+ type: array
+ description:
+ zh: 板块特定的关键绩效指标(例如 ['订阅用户:2.3亿', 'ARPU:$14.99', '流失率:2.1%'])
+ required: false
+ default: ''
+ - name: commentary
+ type: string
+ description:
+ zh: 管理层对板块业绩或展望的评论
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的财务分析师,请从 SEC 申报文件中提取每个业务板块或地理区域的业绩数据。
+
+ '
+ rules:
+ zh:
+ - 每个条目对应一个独立的实体,禁止合并
+ - 实体名称与原文保持一致
+ - 提取每个可识别板块的营收和营业利润
+ - 捕获增长率和与前期的对比数据
+ - 提取板块特定的关键绩效指标和度量
+ - 保留管理层的板块评论
+display:
+ label: '{segment_name} ({segment_type}) | {revenue}'
diff --git a/hyperextract/templates/legacy/presets/finance/shareholder_structure.yaml b/hyperextract/templates/legacy/presets/finance/shareholder_structure.yaml
new file mode 100644
index 0000000..43519e8
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/shareholder_structure.yaml
@@ -0,0 +1,111 @@
+language: zh
+name: ShareholderStructure
+type: graph
+tags:
+- finance
+description:
+ zh: 股东结构图谱 - 从招股说明书或委托声明文件中提取股权结构
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(例如个人、基金、控股公司、信托)
+ required: true
+ default: ''
+ - name: entity_type
+ type: string
+ description:
+ zh: 类型:个人、机构投资者、控股公司、风险投资、私募股权、信托、政府实体、发行公司
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 附加信息(例如'联合创始人兼 CEO'、'B 轮领投机构')
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 持有方/母公司实体名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 被持有方/子公司实体名称
+ required: true
+ default: ''
+ - name: relationship_type
+ type: string
+ description:
+ zh: 类型:直接持股、间接持股、实益所有权、投票权控制、董事会席位、母子公司
+ required: true
+ default: ''
+ - name: ownership_percentage
+ type: string
+ description:
+ zh: 持股比例(例如'15.3%'、'51%'、'控股权')
+ required: false
+ default: ''
+ - name: share_class
+ type: string
+ description:
+ zh: 股份类别(例如'A 类普通股'、'B 类(10 倍投票权)'、'C 轮优先股')
+ required: false
+ default: ''
+ - name: voting_power
+ type: string
+ description:
+ zh: 投票权百分比(若与持股比例不同,例如'65% 投票权')
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的公司治理分析师,请从招股说明书或委托声明文件中提取股权结构。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别所有重要股东(5% 以上实益所有人)
+ - 提取持股比例和股份类别
+ - 映射母子公司和控股公司结构
+ - 注意双重股权结构和投票权差异
+ - 捕捉锁定期和 IPO 后限制条款
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别个人、机构投资者、控股公司和信托
+ - 识别发行公司本身
+ - 按类型对每个实体进行分类
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 将持有方连接到其持有的资产
+ - 提取持股比例和股份类别
+ - 注意投票权差异
+ - 捕捉锁定期
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationship_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({entity_type})'
+ relation_label: '{relationship_type} {ownership_percentage}'
diff --git a/hyperextract/templates/legacy/presets/finance/supply_chain.yaml b/hyperextract/templates/legacy/presets/finance/supply_chain.yaml
new file mode 100644
index 0000000..c8f55aa
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/finance/supply_chain.yaml
@@ -0,0 +1,95 @@
+language: zh
+name: SupplyChainGraph
+type: graph
+tags:
+- finance
+description:
+ zh: 供应链图谱 - 从 SEC 申报文件中提取供应链实体及其关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(公司或供应商)
+ required: true
+ default: ''
+ - name: entity_type
+ type: string
+ description:
+ zh: 类型:客户、供应商、战略伙伴、分销商、本公司
+ required: true
+ default: ''
+ - name: details
+ type: string
+ description:
+ zh: 地理管辖区、认证信息及合规说明
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 上游供应商或提供方
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 下游买方或需求方
+ required: true
+ default: ''
+ - name: relationship_type
+ type: string
+ description:
+ zh: 类型:供应、采购、分销、战略合作
+ required: true
+ default: ''
+ - name: product_service
+ type: string
+ description:
+ zh: 被供应或交易的内容,例如锂芯片、物流服务等
+ required: true
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的供应链分析师,请从文本中提取供应链实体及其关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别供应商、客户和伙伴
+ - 提取交易类型及产品
+ - 将依赖度、交易量及地缘政治风险汇总
+ rules_for_entities:
+ zh:
+ - 每个节点对应一个独立实体
+ - 实体名称与原文保持一致
+ - 识别公司及合作伙伴
+ - 分类角色(客户、供应商、战略伙伴、分销商)
+ - 记录地区及认证至 details
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 通过产品/服务连接实体
+ - 综合评估依赖度、交易量及风险(关税、单一来源)
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationship_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: one_stage
+display:
+ entity_label: '{name} ({entity_type})'
+ relation_label: '{relationship_type}'
diff --git a/hyperextract/templates/legacy/presets/general/clause_list.yaml b/hyperextract/templates/legacy/presets/general/clause_list.yaml
new file mode 100644
index 0000000..e7023c1
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/clause_list.yaml
@@ -0,0 +1,43 @@
+language: zh
+name: ClauseList
+type: list
+tags:
+- general
+description:
+ zh: 规章条文清单 - 将规章制度拆解为逐条的原子化条文,方便快速索引
+output:
+ description: {}
+ fields:
+ - name: clauseId
+ type: string
+ description:
+ zh: 条文编号,如第1条、第2.1款
+ - name: title
+ type: string
+ description:
+ zh: 条目标题/主题
+ required: false
+ - name: content
+ type: string
+ description:
+ zh: 条文内容
+ - name: category
+ type: string
+ description:
+ zh: 条文分类:总则、权利义务、程序、处罚、附则、其他
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的规章制度条文拆解专家,请将文本拆解为逐条的原子化条文。
+
+ '
+ rules:
+ zh:
+ - 将规章制度按其自然结构拆解为独立的条文
+ - 为每条条文分配编号(如第1条、第2.1款等)
+ - 提取条文的内容
+ - 为条文添加适当的标题或主题(如有)
+ - 为每条条文指定分类:总则、权利义务、程序、处罚、附则、其他
+ - 保持条文内容与原文一致,不要遗漏任何条文
+display:
+ label: clauseId
diff --git a/hyperextract/templates/legacy/presets/general/compliance_logic.yaml b/hyperextract/templates/legacy/presets/general/compliance_logic.yaml
new file mode 100644
index 0000000..b5b4159
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/compliance_logic.yaml
@@ -0,0 +1,86 @@
+language: zh
+name: ComplianceLogic
+type: hypergraph
+tags:
+- general
+description:
+ zh: 合规行为超图 - 建模 '在何种条件下,何种主体,必须/禁止执行何种操作' 的复杂逻辑
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 要素名称,文本中出现的精确名称
+ - name: category
+ type: string
+ description:
+ zh: 要素类型:主体、操作、条件、其他
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: ruleType
+ type: string
+ description:
+ zh: 规则类型:必须、禁止、允许、其他
+ - name: participants
+ type: array
+ description:
+ zh: 参与要素名称列表,必须使用已提取节点的 name
+ - name: action
+ type: string
+ description:
+ zh: 要求执行或禁止的操作内容
+ - name: condition
+ type: string
+ description:
+ zh: 适用条件/前置要求
+ required: false
+ - name: consequence
+ type: string
+ description:
+ zh: 违规后果/奖励措施
+ required: false
+ - name: sourceClause
+ type: string
+ description:
+ zh: 规则来源条款
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的合规评估员,请从文本中提取合规要素和规则。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已提取节点创建规则
+ rules_for_entities:
+ zh:
+ - '- 主体:执行动作的实体(个人、部门、组织、角色等)'
+ - '- 操作:具体的行为动作(提交、审批、执行、禁止等)'
+ - '- 条件:规则适用的时间、地点、状态、数量等前提条件'
+ - '- 其他:不属于上述类别的要素(文书、文件、状态、结果等)'
+ rules_for_relations:
+ zh:
+ - '- 必须:必须执行的动作'
+ - '- 禁止:禁止执行的动作'
+ - '- 允许:允许执行的动作'
+ - '- 其他:不属于上述类别的规则'
+identifiers:
+ entity_id: name
+ relation_id: '{ruleType}_{action}_{participants}'
+ relation_members: participants
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '[{ruleType}] {action}'
diff --git a/hyperextract/templates/legacy/presets/general/concept_hierarchy.yaml b/hyperextract/templates/legacy/presets/general/concept_hierarchy.yaml
new file mode 100644
index 0000000..5800a74
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/concept_hierarchy.yaml
@@ -0,0 +1,75 @@
+language: zh
+name: ConceptHierarchy
+type: graph
+tags:
+- general
+description:
+ zh: 概念层级图 - 构建上下位关系或组成关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 概念名称
+ - name: category
+ type: string
+ description:
+ zh: 概念类型:核心概念、子概念、属性、实例、其他
+ - name: description
+ type: string
+ description:
+ zh: 概念简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 父概念/整体概念
+ - name: target
+ type: string
+ description:
+ zh: 子概念/部分概念
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:上下位(Subclass-Of)、组成(Part-Of)、实例(Instance-Of)、其他(Other)
+ - name: details
+ type: string
+ description:
+ zh: 关系详细说明
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的概念结构分析专家,请从文本中提取概念及其层级关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的概念,禁止将多个概念合并为一个节点
+ - 概念名称与原文保持一致
+ - 仅从提取的概念中创建边
+ rules_for_entities:
+ zh:
+ - '- 提取所有概念'
+ - '- 为每个概念指定类型'
+ rules_for_relations:
+ zh:
+ - '- 上下位(Subclass-Of):表示概念的继承关系'
+ - '- 组成(Part-Of):表示整体与部分的关系'
+ - '- 实例(Instance-Of):表示概念与实例的关系'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/general/cross_reference_net.yaml b/hyperextract/templates/legacy/presets/general/cross_reference_net.yaml
new file mode 100644
index 0000000..87cfefe
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/cross_reference_net.yaml
@@ -0,0 +1,76 @@
+language: zh
+name: CrossReferenceNet
+type: graph
+tags:
+- general
+description:
+ zh: 交叉引用网络 - 映射概念之间的超链接或相互引用关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 概念/条目名称
+ - name: type
+ type: string
+ description:
+ zh: 节点类型:条目、章节、概念、人物、地点、其他
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源条目/概念
+ - name: target
+ type: string
+ description:
+ zh: 被引用条目/概念
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:Hyperlink(超链接)、Reference(引用)、SeeAlso(参见)、Related(相关)、Other(其他)
+ - name: context
+ type: string
+ description:
+ zh: 引用上下文描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的知识网络分析专家,请从文本中提取概念/条目及其相互引用关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从提取的节点中创建边
+ rules_for_entities:
+ zh:
+ - '- 提取所有被提及的概念或条目'
+ - '- 为每个节点指定类型'
+ rules_for_relations:
+ zh:
+ - '- Hyperlink:超链接关系'
+ - '- Reference:引用关系'
+ - '- SeeAlso:参见关系'
+ - '- Related:相关关系'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({type})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/general/encyclopedia_item.yaml b/hyperextract/templates/legacy/presets/general/encyclopedia_item.yaml
new file mode 100644
index 0000000..07d7921
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/encyclopedia_item.yaml
@@ -0,0 +1,65 @@
+language: zh
+name: EncyclopediaItem
+type: model
+tags:
+- general
+description:
+ zh: 百科条目 - 针对单一主体提取结构化的属性信息(类似信息框 Infobox)
+output:
+ description: {}
+ fields:
+ - name: title
+ type: string
+ description:
+ zh: 条目标题
+ - name: entityType
+ type: string
+ description:
+ zh: 实体类型:人物、地点、组织、事件、概念、物品、其他
+ - name: alternativeNames
+ type: array
+ description:
+ zh: 别名、俗称、外文名称
+ required: false
+ - name: category
+ type: array
+ description:
+ zh: 分类标签
+ required: false
+ - name: summary
+ type: string
+ description:
+ zh: 摘要/简介
+ required: false
+ - name: attributes
+ type: array
+ description:
+ zh: '关键属性列表,每个元素格式为''属性名: 属性值'''
+ required: false
+ - name: keyEvents
+ type: array
+ description:
+ zh: 重要事件/里程碑
+ required: false
+ - name: relatedConcepts
+ type: array
+ description:
+ zh: 相关概念/条目
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的百科全书编辑,请从文本中提取单一主体的结构化属性信息,构建百科条目信息框。
+
+ '
+ rules:
+ zh:
+ - 识别文本的核心主体(人物、地点、组织、事件、概念等)
+ - 为主体指定类型
+ - 提取所有别名、俗称或外文名称
+ - 提取分类标签
+ - 撰写 100-200 字的摘要
+ - 提取关键属性
+ - 提取重要事件或里程碑
+ - 提取相关概念或条目
+display:
+ label: title
diff --git a/hyperextract/templates/legacy/presets/general/entity_registry.yaml b/hyperextract/templates/legacy/presets/general/entity_registry.yaml
new file mode 100644
index 0000000..c70c2b9
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/entity_registry.yaml
@@ -0,0 +1,39 @@
+language: zh
+name: EntityRegistry
+type: set
+tags:
+- general
+description:
+ zh: 实体注册表 - 去重并汇总文本中出现的所有唯一实体
+output:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,保持与原文一致
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:人物、机构、地点、产品、概念、其他
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的实体识别专家,请从文本中提取所有唯一实体,形成实体注册表。
+
+ '
+ rules:
+ zh:
+ - 提取所有实体:人物、机构、地点、产品、概念等
+ - 为每个实体指定类型
+ - 保持实体名称与原文一致
+ - 为每个实体添加简要描述
+ - 去重:同一实体只保留一条记录
+identifiers:
+ item_id: name
+display:
+ label: name
diff --git a/hyperextract/templates/legacy/presets/general/keyword_list.yaml b/hyperextract/templates/legacy/presets/general/keyword_list.yaml
new file mode 100644
index 0000000..674e829
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/keyword_list.yaml
@@ -0,0 +1,35 @@
+language: zh
+name: KeywordList
+type: list
+tags:
+- general
+description:
+ zh: 关键词列表 - 从文本中提取关键词并附带分类、出现频次信息
+output:
+ description: {}
+ fields:
+ - name: term
+ type: string
+ description:
+ zh: 关键词
+ - name: category
+ type: string
+ description:
+ zh: 分类:核心概念、术语、人名、机构名、其他
+ - name: description
+ type: string
+ description:
+ zh: 关键词简要描述或上下文说明
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的关键词提取专家,请从文本中提取所有关键词并附带分类和描述信息。
+
+ '
+ rules:
+ zh:
+ - 提取文本中的所有关键词和核心短语
+ - 为每个关键词指定分类
+ - 为每个关键词添加简要描述
+display:
+ label: term
diff --git a/hyperextract/templates/legacy/presets/general/knowledge_graph.yaml b/hyperextract/templates/legacy/presets/general/knowledge_graph.yaml
new file mode 100644
index 0000000..f6cf671
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/knowledge_graph.yaml
@@ -0,0 +1,76 @@
+language: zh
+name: KnowledgeGraph
+type: graph
+tags:
+- general
+description:
+ zh: 通用知识图谱 - 从任意文本中提取实体与关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如人名、机构名、产品名
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:人物、机构、地点、产品、概念、其他
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体
+ - name: target
+ type: string
+ description:
+ zh: 目标实体
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:属于、位于、合作、竞争、发明、创建、相关等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的知识图谱提取专家,请从文本中提取实体及其关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从提取的实体中创建边
+ rules_for_entities:
+ zh:
+ - '- 提取所有实体'
+ - '- 为每个实体指定类型'
+ rules_for_relations:
+ zh:
+ - '- 属于:表示归属关系'
+ - '- 位于:表示地理位置关系'
+ - '- 合作:表示合作关系'
+ - '- 竞争:表示竞争关系'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/general/life_event_timeline.yaml b/hyperextract/templates/legacy/presets/general/life_event_timeline.yaml
new file mode 100644
index 0000000..878db14
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/life_event_timeline.yaml
@@ -0,0 +1,94 @@
+language: zh
+name: LifeEventTimeline
+type: temporal_graph
+tags:
+- general
+description:
+ zh: 生活事件时间线 - 提取带时间戳的事件,并按时间顺序排列
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称
+ - name: type
+ type: string
+ description:
+ zh: 实体类型:人物、地点、组织、物品、概念、其他
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 事件主体/相关实体
+ - name: target
+ type: string
+ description:
+ zh: 事件对象/相关实体
+ - name: eventType
+ type: string
+ description:
+ zh: 事件类型:出生、逝世、教育、工作、成就、交往、旅行、其他
+ - name: eventDate
+ type: string
+ description:
+ zh: 事件日期,格式为年-月-日或年份
+ required: false
+ - name: details
+ type: string
+ description:
+ zh: 事件详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的传记年表专家,请从文本中提取人物、地点、组织等实体以及生活事件。
+
+ '
+ rules:
+ zh:
+ - 提取所有相关实体
+ - 为每个实体指定类型
+ - 仅从提取的实体中创建事件边
+ rules_for_entities:
+ zh:
+ - '- 人物、地点、组织、物品、概念等实体'
+ rules_for_relations:
+ zh:
+ - '- 事件类型:出生、逝世、教育、工作、成就、交往、旅行、其他'
+ - '- 时间信息为可选,仅在文本中明确提及时才提取'
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期):
+ - '- "去年" → {observation_time} 前一年'
+ - '- "今年" → {observation_time} 所属年份'
+ - '- "明年" → {observation_time} 后一年'
+ - '- "昨天/今天/明天" → {observation_time} 前/当/后一天'
+ - '- "十年前/五年后" → {observation_time} 前/后相应年数'
+ - '- "年初/年末" → 当年 1月1日/12月31日'
+ - '- "朝代" → 保留朝代名称'
+ - 明确日期:保持原格式
+ - '- 年份(如 429年、2023年)→ 429、2023'
+ - '- 年-月-日 → 保持原格式'
+ - 缺失时间:留空
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{eventType}|{details}'
+ relation_members:
+ source: source
+ target: target
+ time_field: eventDate
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({type})'
+ relation_label: '{eventType}'
diff --git a/hyperextract/templates/legacy/presets/general/operational_procedure.yaml b/hyperextract/templates/legacy/presets/general/operational_procedure.yaml
new file mode 100644
index 0000000..3823262
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/operational_procedure.yaml
@@ -0,0 +1,93 @@
+language: zh
+name: OperationalProcedure
+type: graph
+tags:
+- general
+description:
+ zh: 执行程序流程图 - 提取规章中规定的申报、审批或操作的具体先后步骤
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: stepId
+ type: string
+ description:
+ zh: 步骤编号,如步骤1、步骤2
+ - name: name
+ type: string
+ description:
+ zh: 步骤名称
+ - name: description
+ type: string
+ description:
+ zh: 步骤详细描述
+ - name: role
+ type: string
+ description:
+ zh: 执行角色
+ required: false
+ - name: inputRequired
+ type: string
+ description:
+ zh: 所需输入/材料
+ required: false
+ - name: outputResult
+ type: string
+ description:
+ zh: 输出/结果
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源步骤编号
+ - name: target
+ type: string
+ description:
+ zh: 目标步骤编号
+ - name: condition
+ type: string
+ description:
+ zh: 转换条件
+ required: false
+ - name: details
+ type: string
+ description:
+ zh: 详细说明
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的流程分析专家,请从文本中提取执行程序的步骤和转换关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的步骤,禁止将多个步骤合并为一个节点
+ - 步骤名称与原文保持一致
+ - 仅从提取的步骤中创建转换边
+ rules_for_entities:
+ zh:
+ - '- 提取所有流程步骤'
+ - '- 为每个步骤分配编号'
+ - '- 记录步骤名称和描述'
+ - '- 记录执行角色(如有)'
+ - '- 记录所需输入或材料(如有)'
+ - '- 记录输出或结果(如有)'
+ rules_for_relations:
+ zh:
+ - '- 记录步骤之间的先后关系'
+ - '- 记录转换条件(如有)'
+identifiers:
+ entity_id: stepId
+ relation_id: '{source}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{stepId}: {name}'
+ relation_label: condition
diff --git a/hyperextract/templates/legacy/presets/general/penalty_mapping.yaml b/hyperextract/templates/legacy/presets/general/penalty_mapping.yaml
new file mode 100644
index 0000000..d2165e3
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/penalty_mapping.yaml
@@ -0,0 +1,76 @@
+language: zh
+name: PenaltyMapping
+type: graph
+tags:
+- general
+description:
+ zh: 违规处罚因果链 - 描述从'违规行为'到'处理程序'再到'最终结果'的演变路径
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 节点名称
+ - name: type
+ type: string
+ description:
+ zh: 节点类型:违规行为、处理程序、处罚结果、其他
+ - name: description
+ type: string
+ description:
+ zh: 详细描述
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源节点名称
+ - name: target
+ type: string
+ description:
+ zh: 目标节点名称
+ - name: relation
+ type: string
+ description:
+ zh: 关系类型:导致、触发、执行、产生、其他
+ - name: details
+ type: string
+ description:
+ zh: 详细说明
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的处罚逻辑分析专家,请从文本中提取违规处罚的因果链。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从提取的节点中创建因果路径边
+ rules_for_entities:
+ zh:
+ - '- 违规行为:违反规定的行为'
+ - '- 处理程序:处理违规的流程'
+ - '- 处罚结果:最终的处罚结果'
+ rules_for_relations:
+ zh:
+ - '- 导致:表示因果关系'
+ - '- 触发:表示引发关系'
+ - '- 执行:表示执行关系'
+ - '- 产生:表示结果关系'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relation}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({type})'
+ relation_label: '{relation}'
diff --git a/hyperextract/templates/legacy/presets/general/penalty_registry.yaml b/hyperextract/templates/legacy/presets/general/penalty_registry.yaml
new file mode 100644
index 0000000..79f91fa
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/penalty_registry.yaml
@@ -0,0 +1,49 @@
+language: zh
+name: PenaltyRegistry
+type: set
+tags:
+- general
+description:
+ zh: 违规处罚对照表 - 去重汇总特定的违规行为及其对应的后果,形成清晰的处罚台账
+output:
+ description: {}
+ fields:
+ - name: violation
+ type: string
+ description:
+ zh: 违规行为描述
+ - name: severity
+ type: string
+ description:
+ zh: 严重程度:轻微、一般、严重、特别严重
+ - name: penalty
+ type: string
+ description:
+ zh: 处罚措施
+ - name: applicableClause
+ type: string
+ description:
+ zh: 适用条款
+ required: false
+ - name: notes
+ type: string
+ description:
+ zh: 备注说明
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的合规分析专家,请从文本中提取所有违规行为及其对应的处罚措施,形成违规处罚对照表。
+
+ '
+ rules:
+ zh:
+ - 提取所有违规行为及其对应的处罚措施
+ - 为每条违规行为指定严重程度
+ - 保持违规行为和处罚措施的准确性
+ - 记录适用的条款(如有)
+ - 添加备注说明(如有)
+ - 去重:相同的违规行为和处罚措施组合只保留一条
+identifiers:
+ item_id: violation
+display:
+ label: violation
diff --git a/hyperextract/templates/legacy/presets/general/personal_profile.yaml b/hyperextract/templates/legacy/presets/general/personal_profile.yaml
new file mode 100644
index 0000000..dfc7b40
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/personal_profile.yaml
@@ -0,0 +1,86 @@
+language: zh
+name: PersonalProfile
+type: model
+tags:
+- general
+description:
+ zh: 个人档案 - 聚合人物的静态属性(生卒年、学历、核心身份)
+output:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 姓名
+ - name: gender
+ type: string
+ description:
+ zh: 性别
+ required: false
+ - name: birthDate
+ type: string
+ description:
+ zh: 出生日期,格式为年-月-日或年份
+ required: false
+ - name: deathDate
+ type: string
+ description:
+ zh: 逝世日期,格式为年-月-日或年份
+ required: false
+ - name: nationality
+ type: string
+ description:
+ zh: 国籍
+ required: false
+ - name: birthPlace
+ type: string
+ description:
+ zh: 出生地
+ required: false
+ - name: education
+ type: array
+ description:
+ zh: 教育经历
+ required: false
+ - name: occupations
+ type: array
+ description:
+ zh: 职业/身份
+ required: false
+ - name: coreIdentity
+ type: array
+ description:
+ zh: 核心身份/标签
+ required: false
+ - name: majorAchievements
+ type: array
+ description:
+ zh: 主要成就
+ required: false
+ - name: affiliations
+ type: array
+ description:
+ zh: 所属组织/机构
+ required: false
+ - name: summary
+ type: string
+ description:
+ zh: 个人简介
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的人物档案编辑,请从文本中提取该人物的静态属性信息,构建个人档案。
+
+ '
+ rules:
+ zh:
+ - 提取姓名、性别、出生日期、逝世日期、国籍、出生地等基本信息
+ - 提取教育经历
+ - 提取职业或身份信息
+ - 提取核心身份标签
+ - 提取主要成就
+ - 提取所属组织或机构
+ - 撰写 100-200 字的个人简介
+ - 若信息缺失时留空,不要编造
+display:
+ label: name
diff --git a/hyperextract/templates/legacy/presets/general/regulation_profile.yaml b/hyperextract/templates/legacy/presets/general/regulation_profile.yaml
new file mode 100644
index 0000000..9e3a883
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/regulation_profile.yaml
@@ -0,0 +1,83 @@
+language: zh
+name: RegulationProfile
+type: model
+tags:
+- general
+description:
+ zh: 规章元数据快照 - 提取制度的名称、版本、适用范围、生效日期及核心宗旨
+output:
+ description: {}
+ fields:
+ - name: title
+ type: string
+ description:
+ zh: 规章名称
+ - name: version
+ type: string
+ description:
+ zh: 版本号
+ required: false
+ - name: issuer
+ type: string
+ description:
+ zh: 发布机构
+ required: false
+ - name: issueDate
+ type: string
+ description:
+ zh: 发布日期
+ required: false
+ - name: effectiveDate
+ type: string
+ description:
+ zh: 生效日期
+ required: false
+ - name: expiryDate
+ type: string
+ description:
+ zh: 失效日期
+ required: false
+ - name: scope
+ type: array
+ description:
+ zh: 适用范围
+ required: false
+ - name: targetAudience
+ type: array
+ description:
+ zh: 适用对象
+ required: false
+ - name: corePurpose
+ type: string
+ description:
+ zh: 核心宗旨/目的
+ required: false
+ - name: keywords
+ type: array
+ description:
+ zh: 关键词/标签
+ required: false
+ - name: relatedRegulations
+ type: array
+ description:
+ zh: 关联规章
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的规章制度分析专家,请从文本中提取该规章制度的元数据信息,构建规章元数据快照。
+
+ '
+ rules:
+ zh:
+ - 提取规章的完整名称
+ - 提取版本号(如有)
+ - 提取发布机构
+ - 提取发布日期、生效日期、失效日期(如有)
+ - 提取适用范围
+ - 提取适用对象
+ - 提取核心宗旨或目的
+ - 提取关键词或标签
+ - 提取关联的其他规章
+ - 信息缺失时留空,不要编造
+display:
+ label: title
diff --git a/hyperextract/templates/legacy/presets/general/social_network.yaml b/hyperextract/templates/legacy/presets/general/social_network.yaml
new file mode 100644
index 0000000..039e926
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/general/social_network.yaml
@@ -0,0 +1,85 @@
+language: zh
+name: SocialNetwork
+type: graph
+tags:
+- general
+description:
+ zh: 社交网络图 - 专注于提取人际关系、互动与组织隶属
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 名称
+ - name: type
+ type: string
+ description:
+ zh: 节点类型:人物、组织、机构、其他
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ - name: role
+ type: string
+ description:
+ zh: 角色/身份
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源节点
+ - name: target
+ type: string
+ description:
+ zh: 目标节点
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:亲属、朋友、同事、师生、上下级、合作、竞争、隶属、其他
+ - name: details
+ type: string
+ description:
+ zh: 关系详细说明
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的社会关系分析专家,请从文本中提取人物、组织及其相互关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从提取的节点中创建边
+ rules_for_entities:
+ zh:
+ - '- 提取所有人物、组织、机构等'
+ - '- 为每个节点指定类型和角色'
+ rules_for_relations:
+ zh:
+ - '- 亲属:血缘或姻亲关系'
+ - '- 朋友:朋友关系'
+ - '- 同事:工作关系'
+ - '- 师生:教育关系'
+ - '- 上下级:层级关系'
+ - '- 合作:合作关系'
+ - '- 竞争:竞争关系'
+ - '- 隶属:组织隶属关系'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({role})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/industry/emergency_response_graph.yaml b/hyperextract/templates/legacy/presets/industry/emergency_response_graph.yaml
new file mode 100644
index 0000000..2712902
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/emergency_response_graph.yaml
@@ -0,0 +1,106 @@
+language: zh
+name: EmergencyResponseGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 应急预案图谱 - 提取事故场景、响应动作和部门,构建应急响应流程,识别应急响应的流程和责任分工
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(如:火灾、停电、报警、疏散人员、设备部等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:事故场景、响应动作、部门
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 对该实体的描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体名称(事故场景或响应动作)
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体名称(响应动作或部门)
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:触发、执行、负责
+ required: true
+ default: ''
+ - name: time_limit
+ type: string
+ description:
+ zh: 响应时间要求(如:5分钟内、10分钟内)
+ required: false
+ default: ''
+ - name: success_criterion
+ type: string
+ description:
+ zh: 成功标准(如:人员安全撤离、火势控制)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业应急管理分析专家,请从文本中提取事故场景、响应动作和部门,构建应急响应流程。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别事故场景(如火灾、泄漏、停电、设备故障、人员受伤等)
+ - 识别响应动作(如报警、疏散人员、关闭电源等)
+ - 识别负责部门(如安保部、设备部、急救部、后勤部等)
+ - 建立从事故场景到响应动作的流程关系
+ - 记录时间要求和成功标准
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别事故场景名称(如火灾、泄漏、停电、设备故障)
+ - 识别响应动作名称(如报警、疏散人员、关闭电源)
+ - 识别负责部门名称(如安保部、设备部、急救部)
+ - 为每个实体指定类别(事故场景/响应动作/部门)
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别从事故场景到响应动作的关联
+ - 识别从响应动作到负责部门的关联
+ - 记录响应时间要求
+ - 记录成功标准
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/industry/equipment_topology_graph.yaml b/hyperextract/templates/legacy/presets/industry/equipment_topology_graph.yaml
new file mode 100644
index 0000000..ad8acd3
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/equipment_topology_graph.yaml
@@ -0,0 +1,117 @@
+language: zh
+name: EquipmentTopologyGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 设备拓扑图谱 - 提取工业设备的实体及其相互连接关系,包括物料流向、能量传递、控制信号等
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 设备或部件名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:主机、辅机、部件、仪表、阀门、管路、系统、电机、泵、风机、容器等
+ required: true
+ default: ''
+ - name: location
+ type: string
+ description:
+ zh: 安装位置(如:生产车间一层、主厂房二层)
+ required: false
+ default: ''
+ - name: status
+ type: string
+ description:
+ zh: 运行状态:运行、备用、检修、停运
+ required: false
+ default: ''
+ - name: specification
+ type: string
+ description:
+ zh: 规格型号或技术参数
+ required: false
+ default: ''
+ - name: manufacturer
+ type: string
+ description:
+ zh: 制造厂家
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 上游设备或源设备名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 下游设备或目标设备名称
+ required: true
+ default: ''
+ - name: connectionType
+ type: string
+ description:
+ zh: 连接类型:物料输送、能量传递、控制信号、工艺流程、电气连接、仪表监测等
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 连接关系的详细描述(如:高温物料流向、循环水回路、闭环控制系统)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业设备管理专家,请从文本中提取设备实体及其相互连接关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的设备,禁止将多个设备合并为一个节点
+ - 设备名称与原文保持一致
+ - 仅从已知设备列表中提取边,不要创建新的设备节点
+ - 关系描述应与原文保持一致
+ - 识别所有设备、部件和系统
+ - 分类设备类型(主机/辅机/部件/仪表/阀门/管路/系统/电机/泵/风机/容器等)
+ - 提取设备之间的连接关系,包括物料输送、能量传递、控制信号等
+ - 记录安装位置和运行状态
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的设备,禁止将多个设备合并为一个节点
+ - 设备名称与原文保持一致
+ - 识别设备名称和部件名称
+ - 分类设备类别(主机、辅机、部件、仪表、阀门、管路、系统、电机、泵、风机、容器等)
+ - 记录安装位置和运行状态
+ rules_for_relations:
+ zh:
+ - 仅从已知设备列表中提取边,不要创建新的设备节点
+ - 关系描述应与原文保持一致
+ - 识别物料输送关系(上游→下游)
+ - 识别能量传递关系(驱动设备→被驱动设备)
+ - 识别控制信号关系(控制设备→被控设备)
+ - 识别工艺流程关系(前一工序→后一工序)
+ - 识别电气连接和仪表监测关系
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{connectionType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{connectionType}'
diff --git a/hyperextract/templates/legacy/presets/industry/failure_case_graph.yaml b/hyperextract/templates/legacy/presets/industry/failure_case_graph.yaml
new file mode 100644
index 0000000..69d8d57
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/failure_case_graph.yaml
@@ -0,0 +1,106 @@
+language: zh
+name: FailureCaseGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 故障案例图谱 - 提取故障现象、原因、措施和教训,识别从发现到处理的完整故障演进链条
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 现象/措施等实体的名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:现象、原因、措施、教训
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 对该实体内涵的进一步阐述和说明
+ required: false
+ default: ''
+ - name: equipment
+ type: string
+ description:
+ zh: 涉及设备名称
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 上游环节名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 下游环节名称
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:导致、采取、产生、发现
+ required: true
+ default: ''
+ - name: time_sequence
+ type: string
+ description:
+ zh: 时序关系:发现、分析、处理、总结
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业设备故障分析专家,请从文本中提取故障现象、原因、处理措施和经验教训。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别故障现象和异常表现
+ - 分析故障原因和根本原因
+ - 提取处理措施和解决方案
+ - 总结经验教训和改进建议
+ - 建立从发现到处理的完整链条
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别故障现象和异常表现
+ - 识别故障原因和根本原因
+ - 识别处理措施和解决方案
+ - 识别经验教训和改进建议
+ - 记录涉及的设备名称
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别从现象到原因的关联
+ - 识别从原因到措施的关联
+ - 识别从措施到教训的关联
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/industry/failure_knowledge_hypergraph.yaml b/hyperextract/templates/legacy/presets/industry/failure_knowledge_hypergraph.yaml
new file mode 100644
index 0000000..f512a99
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/failure_knowledge_hypergraph.yaml
@@ -0,0 +1,91 @@
+language: zh
+name: FailureKnowledgeHypergraph
+type: hypergraph
+tags:
+- industry
+description:
+ zh: 故障知识超图 - 从故障案例中提取故障现象、根因、部件、解决方案的复杂关联关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(例如:振动异常、轴承损坏密封失效等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类型:故障现象、根因、部件、解决方案
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 描述(例如:表现为轴承温度升高、由于润滑不良导致)
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: nodes
+ type: array
+ description:
+ zh: 参与故障推理的节点列表:[故障现象1, 故障现象2, ..., 根因, 部件, 解决方案1, 解决方案2, ...]
+ required: true
+ default: ''
+ - name: reasoning_type
+ type: string
+ description:
+ zh: 推理类型:故障诊断、原因分析、解决方案
+ required: true
+ default: ''
+ - name: failure_description
+ type: string
+ description:
+ zh: 故障详细描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位设备故障诊断专家,请从故障案例中提取故障知识实体和故障诊断推理作为超边。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 识别故障现象(振动异常、噪音、温度升高、泄漏、异响)
+ - 识别故障根因(润滑不良、过载、磨损、老化、设计缺陷)
+ - 识别故障部件(轴承、密封、电机、泵体、阀门)
+ - 识别解决方案(更换备件、调整参数、清洁、紧固)
+ - 建立从现象→根因→解决方案的完整推理链条
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别故障现象(振动异常、噪音、温度升高、泄漏、异响)
+ - 识别故障根因(润滑不良、过载、磨损、老化、设计缺陷)
+ - 识别故障部件(轴承、密封、电机、泵体、阀门)
+ - 识别解决方案(更换备件、调整参数、清洁、紧固)
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别故障现象(振动异常、噪音、温度升高、泄漏、异响)
+ - 识别从现象到根因的推理
+ - 识别从根因到解决方案的推理
+ - 边的 nodes 字段应包含所有参与该故障推理的实体
+identifiers:
+ entity_id: name
+ relation_id: '{reasoning_type}_{nodes}'
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{reasoning_type}'
diff --git a/hyperextract/templates/legacy/presets/industry/incident_causality_map.yaml b/hyperextract/templates/legacy/presets/industry/incident_causality_map.yaml
new file mode 100644
index 0000000..95e21b6
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/incident_causality_map.yaml
@@ -0,0 +1,100 @@
+language: zh
+name: IncidentCausalityMap
+type: hypergraph
+tags:
+- industry
+description:
+ zh: 事故因果链超图 - 从事故调查报告中提取隐患、触发条件、违章行为、事故后果的因果关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(例如:违章操作、泄漏积累、点火源等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类型:隐患、触发条件、违章行为、事故后果
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 描述(例如:未佩戴安全带、管道腐蚀破裂)
+ required: false
+ default: ''
+ - name: severity
+ type: string
+ description:
+ zh: 严重程度:轻微、一般、严重、重大
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: nodes
+ type: array
+ description:
+ zh: 参与因果链条的节点列表:[隐患1, 隐患2, ..., 触发条件, 违章行为, 事故后果1, 事故后果2, ...]
+ required: true
+ default: ''
+ - name: causality_type
+ type: string
+ description:
+ zh: 因果类型:隐患积累、触发导致、违章促成、后果扩展
+ required: true
+ default: ''
+ - name: causality_description
+ type: string
+ description:
+ zh: 因果关系详细描述(例如:由于管道腐蚀导致泄漏,遇火源引发火灾)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业安全事故调查专家,请从事故调查报告中提取实体和事故因果链条作为超边。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 识别隐患(设备老化、防护缺失、管理漏洞、安全培训不足)
+ - 识别触发条件(点火源、静电、明火、高温)
+ - 识别违章行为(违章操作、违章指挥、违反劳动纪律)
+ - 识别事故后果(人员伤亡、设备损坏、环境污染、停产损失)
+ - 建立完整的因果链条:隐患 → 触发条件 → 违章行为 → 事故后果
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别隐患(设备老化、防护缺失、管理漏洞、安全培训不足)
+ - 识别触发条件(点火源、静电、明火、高温)
+ - 识别违章行为(违章操作、违章指挥、违反劳动纪律)
+ - 识别事故后果(人员伤亡、设备损坏、环境污染、停产损失)
+ - 为实体指定严重程度
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别隐患积累过程
+ - 识别触发条件的作用
+ - 识别违章行为的促成作用
+ - 识别事故后果的扩展
+ - 建立完整的因果链条:隐患 → 触发条件 → 违章行为 → 事故后果
+ - 边的 nodes 字段应包含所有参与该因果链条的实体
+identifiers:
+ entity_id: name
+ relation_id: '{causality_type}_{nodes}'
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{causality_type}'
diff --git a/hyperextract/templates/legacy/presets/industry/inspection_record_graph.yaml b/hyperextract/templates/legacy/presets/industry/inspection_record_graph.yaml
new file mode 100644
index 0000000..46a690d
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/inspection_record_graph.yaml
@@ -0,0 +1,95 @@
+language: zh
+name: InspectionRecordGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 巡检记录图谱 - 提取设备和巡检项,构建巡检层级结构,识别设备与巡检项之间的从属关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(如:数控加工中心、机械臂系统、电机运行状态、轴承温度检查等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:设备、巡检项
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 对该实体的描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 父实体(整体/设备)名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 子实体(巡检项/部分)名称
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:属于、子类
+ required: true
+ default: ''
+ - name: details
+ type: string
+ description:
+ zh: 关系详细说明
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业设备巡检分析专家,请从文本中提取设备和巡检项,构建巡检层级结构。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别大设备(如数控加工中心、机械臂系统、物料输送系统等)
+ - 识别每个设备下的巡检项(如电机运行状态、轴承温度、冷却液位等)
+ - 建立巡检项与设备之间的从属关系
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别设备名称(大类)
+ - 识别巡检项名称(具体检查点)
+ - 为每个实体指定类别(设备/巡检项)
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别巡检项与设备之间的从属关系
+ - 例如:电机运行状态 属于 数控加工中心
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/industry/maintenace_operation_map.yaml b/hyperextract/templates/legacy/presets/industry/maintenace_operation_map.yaml
new file mode 100644
index 0000000..96a28ec
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/maintenace_operation_map.yaml
@@ -0,0 +1,111 @@
+language: zh
+name: MaintenaceOperationMap
+type: hypergraph
+tags:
+- industry
+description:
+ zh: 维修作业图 - 从维修作业指导书中提取操作人、工具、对象、耗时的复杂关联关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(例如:维修工李四、扳手、离心泵P-101、润滑油等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类型:人员、工具、设备、材料、备件、岗位
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 描述或规格(例如:高级维修工、16mm开口扳手、15kW离心泵)
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: nodes
+ type: array
+ description:
+ zh: 参与作业的节点列表:[操作人员, 工具1, 工具2, 设备, 材料1, ...]
+ required: true
+ default: ''
+ - name: operation_name
+ type: string
+ description:
+ zh: 作业名称或步骤(例如:更换轴承、清洗过滤器、添加润滑油)
+ required: true
+ default: ''
+ - name: duration
+ type: string
+ description:
+ zh: 作业耗时(例如:30分钟、2小时、半天)
+ required: false
+ default: ''
+ - name: prerequisite
+ type: string
+ description:
+ zh: 前置条件或注意事项(例如:需停机断电、需佩戴防护用品)
+ required: false
+ default: ''
+ - name: quality_standard
+ type: string
+ description:
+ zh: 质量标准或验收要求(例如:运转正常无异响、螺栓紧固力矩达标)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位设备维修管理专家,请从维修作业指导书中提取实体和维修作业中的复杂关联作为超边。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 识别维修人员(维修工、班组长、技术员)
+ - 识别工具(扳手、螺丝刀、千斤顶、测量仪器)
+ - 识别设备(离心泵、电机、阀门)
+ - 识别材料(润滑油、密封胶、清洁剂)
+ - 识别备件(轴承、密封圈、滤芯)
+ - 识别维修作业步骤(更换轴承、清洗过滤器、添加润滑油)
+ - 关联操作人员和工具
+ - 关联设备和材料/备件
+ - 提取作业耗时
+ - 记录前置条件和质量标准
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别维修人员(维修工、班组长、技术员)
+ - 识别工具(扳手、螺丝刀、千斤顶、测量仪器)
+ - 识别设备(离心泵、电机、阀门)
+ - 识别材料(润滑油、密封胶、清洁剂)
+ - 识别备件(轴承、密封圈、滤芯)
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别维修作业步骤(更换轴承、清洗过滤器、添加润滑油)
+ - 关联操作人员和工具
+ - 关联设备和材料/备件
+ - 提取作业耗时
+ - 记录前置条件和质量标准
+ - 边的 nodes 字段应包含所有参与该作业的实体
+identifiers:
+ entity_id: name
+ relation_id: '{operation_name}_{nodes}'
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{operation_name}'
diff --git a/hyperextract/templates/legacy/presets/industry/operating_mode_graph.yaml b/hyperextract/templates/legacy/presets/industry/operating_mode_graph.yaml
new file mode 100644
index 0000000..342913d
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/operating_mode_graph.yaml
@@ -0,0 +1,111 @@
+language: zh
+name: OperatingModeGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 工况切换图谱 - 提取工况类型和切换条件,识别不同工况之间的切换条件和步骤
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(如:自动运行模式、手动调试模式、待机模式、紧急停止模式、按下启动按钮、按下停止按钮、发生故障等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:工况、条件。工况如自动运行、手动调试、待机等;条件如启动按钮、停止按钮、故障信号等
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 对该实体的描述
+ required: false
+ default: ''
+ - name: load_range
+ type: string
+ description:
+ zh: 负荷范围(如:0-50%、50-80%、80-100%等),仅对工况类别有效
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体名称(工况或条件)
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体名称(工况或条件)
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:切换到、触发
+ required: true
+ default: ''
+ - name: transition_condition
+ type: string
+ description:
+ zh: 切换条件(如:按下启动按钮、按下停止按钮、发生故障等)
+ required: false
+ default: ''
+ - name: transition_procedure
+ type: string
+ description:
+ zh: 切换步骤
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业设备工况分析专家,请从文本中提取工况和条件实体,以及它们之间的关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别各种运行模式(工况),如自动运行、手动调试、待机、紧急停止等
+ - 识别各种触发条件,如按下启动按钮、按下停止按钮、发生故障等
+ - 识别每种工况的适用条件和负荷范围
+ - 提取工况之间的切换关系(切换到)
+ - 提取条件触发工况的关系(触发)
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别工况名称(如自动运行模式、手动调试模式、待机模式、紧急停止模式等)
+ - 识别条件名称(如按下启动按钮、按下停止按钮、发生故障、恢复正常等)
+ - 为每个实体指定类别(工况/条件)
+ - 记录每种工况的负荷范围
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别工况之间的切换关系(源工况 切换到 目标工况)
+ - 识别条件对工况的触发关系(条件 触发 目标工况)
+ - 关系类型使用 切换到 或 触发
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/industry/operation_flow_graph.yaml b/hyperextract/templates/legacy/presets/industry/operation_flow_graph.yaml
new file mode 100644
index 0000000..1165db2
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/operation_flow_graph.yaml
@@ -0,0 +1,117 @@
+language: zh
+name: OperationFlowGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 操作流程图谱 - 提取操作步骤、设备状态和预期结果,识别操作流程中的步骤顺序和状态变化
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 操作步骤名称(如:开启辅助电源、启动液压系统、检查状态、关闭主电源等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:动作、设备状态。动作如开启、关闭、检查等;设备状态如运行中、待机、停止等
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 对该操作步骤的详细描述
+ required: false
+ default: ''
+ - name: expected_result
+ type: string
+ description:
+ zh: 执行该步骤后的预期结果
+ required: false
+ default: ''
+ - name: target_equipment
+ type: string
+ description:
+ zh: 涉及的目标设备名称
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 当前步骤名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 下一步骤名称
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:下一步、触发、导致
+ required: true
+ default: ''
+ - name: trigger_condition
+ type: string
+ description:
+ zh: 触发下一步骤的条件
+ required: false
+ default: ''
+ - name: state_change
+ type: string
+ description:
+ zh: 状态变化描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业操作流程分析专家,请从文本中提取操作步骤、设备状态和预期结果。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别各个操作步骤和执行顺序(如:开启辅助电源 → 启动液压系统 → 启动控制系统)
+ - 识别设备状态变化(如:从待机状态切换到运行状态)
+ - 记录每一步骤的详细操作内容、预期结果和涉及设备
+ - 建立步骤之间的流转关系
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别操作步骤名称(如开启辅助电源、启动液压系统、检查状态、关闭主电源等)
+ - 识别设备状态名称(如运行中、待机、停止、故障等)
+ - 为每个实体指定类别(动作/设备状态)
+ - 记录每一步骤的预期结果和涉及设备
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别步骤的执行顺序(当前步骤 → 下一步骤)
+ - 提取触发下一步骤的条件
+ - 记录设备状态的变化
+ - 关系类型使用:下一步、触发、导致
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/industry/part_replacement_list.yaml b/hyperextract/templates/legacy/presets/industry/part_replacement_list.yaml
new file mode 100644
index 0000000..0a1be50
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/part_replacement_list.yaml
@@ -0,0 +1,68 @@
+language: zh
+name: PartReplacementList
+type: list
+tags:
+- industry
+description:
+ zh: 备件消耗清单 - 从设备维护记录中提取零件型号、数量、更换原因
+output:
+ description: {}
+ fields:
+ - name: part_name
+ type: string
+ description:
+ zh: 备件名称(例如:轴承、密封圈、滤芯、润滑油、刀片等)
+ required: true
+ default: ''
+ - name: part_number
+ type: string
+ description:
+ zh: 备件型号或编号(例如:SKF-6205、GB/T1234-2010)
+ required: false
+ default: ''
+ - name: quantity
+ type: string
+ description:
+ zh: 更换数量(例如:2件、5升、1套)
+ required: false
+ default: ''
+ - name: unit
+ type: string
+ description:
+ zh: 计量单位(例如:件、个、套、升、公斤)
+ required: false
+ default: ''
+ - name: replacement_reason
+ type: string
+ description:
+ zh: 更换原因(例如:磨损、老化、损坏、预防性更换)
+ required: false
+ default: ''
+ - name: equipment_name
+ type: string
+ description:
+ zh: 所属设备名称(例如:离心泵P-101、空压机C-001)
+ required: false
+ default: ''
+ - name: maintenance_type
+ type: string
+ description:
+ zh: 维护类型:例行保养、故障维修、计划检修、抢修
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位设备维护管理专家,请从备件更换记录中提取所有备件消耗条目。
+
+ '
+ rules:
+ zh:
+ - 每个条目对应一个独立的备件,禁止合并
+ - 备件名称和型号与原文保持一致
+ - 提取备件名称、型号、编号
+ - 提取更换数量和计量单位
+ - 提取更换原因(磨损、老化、损坏、预防性更换等)
+ - 提取所属设备名称
+ - 识别维护类型(例行保养、故障维修、计划检修、抢修)
+display:
+ label: '{part_name} x{quantity} ({replacement_reason})'
diff --git a/hyperextract/templates/legacy/presets/industry/safety_control_graph.yaml b/hyperextract/templates/legacy/presets/industry/safety_control_graph.yaml
new file mode 100644
index 0000000..0c2e82c
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/safety_control_graph.yaml
@@ -0,0 +1,116 @@
+language: zh
+name: SafetyControlGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 安全管控图谱 - 提取危险源、风险点和管控措施,构建安全管控关系,识别安全风险与管控责任的对应关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(如:数控加工中心、烫伤风险、佩戴防护用品、安全主管等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:危险源、风险点、管控措施、责任人
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 对该实体的描述
+ required: false
+ default: ''
+ - name: risk_level
+ type: string
+ description:
+ zh: 风险等级:重大风险、较大风险、一般风险,仅对风险点类别有效
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体名称(危险源或风险点或管控措施)
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体名称(风险点或管控措施或责任人)
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:导致、需要、管控、负责
+ required: true
+ default: ''
+ - name: hazard_factor
+ type: string
+ description:
+ zh: 危险因素(如:高温部件、旋转部件、高压液体等)
+ required: false
+ default: ''
+ - name: possible_consequence
+ type: string
+ description:
+ zh: 可能导致后果(如:烫伤、机械伤害、触电等)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业安全管理分析专家,请从文本中提取危险源、风险点和管控措施,构建安全管控关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别危险源(如数控加工中心、工业机械臂、冷却系统、液压站、电气控制柜等)
+ - 识别风险点(如烫伤风险、机械伤害风险、触电风险、摔伤风险等)
+ - 识别管控措施(如佩戴防护用品、设置安全围栏、定期检修、通风换气等)
+ - 识别责任人(如安全主管、设备负责人、班组长、电工等)
+ - 为风险点指定风险等级(重大风险、较大风险、一般风险)
+ - 建立从危险源→风险点→管控措施→责任人的完整管控链条
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别危险源名称(如数控加工中心、工业机械臂、冷却系统、液压站、电气控制柜等)
+ - 识别风险点名称(如烫伤风险、机械伤害风险、触电风险、摔伤风险等)
+ - 识别管控措施名称(如佩戴防护用品、设置安全围栏、定期检修、通风换气等)
+ - 识别责任人名称(如安全主管、设备负责人、班组长、电工等)
+ - 为每个实体指定类别(危险源/风险点/管控措施/责任人)
+ - 为风险点指定风险等级(重大风险、较大风险、一般风险)
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别从危险源到风险点的关联(关系类型:导致)
+ - 识别从风险点到管控措施的关联(关系类型:需要/管控)
+ - 识别从管控措施到责任人的关联(关系类型:负责)
+ - 记录危险因素和可能导致后果
+ - 关系类型使用:导致、需要、管控、负责
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/industry/safety_timeline.yaml b/hyperextract/templates/legacy/presets/industry/safety_timeline.yaml
new file mode 100644
index 0000000..1178823
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/safety_timeline.yaml
@@ -0,0 +1,116 @@
+language: zh
+name: SafetyTimeline
+type: temporal_graph
+tags:
+- industry
+description:
+ zh: 事故时序图 - 从事故调查报告中提取时间线,还原事故发生前后的操作与响应序列
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称
+ required: true
+ default: ''
+ - name: entity_type
+ type: string
+ description:
+ zh: 类型:人员、设备、设施等
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体名称
+ required: true
+ default: ''
+ - name: action
+ type: string
+ description:
+ zh: 操作动作
+ required: true
+ default: ''
+ - name: timestamp
+ type: string
+ description:
+ zh: 动作发生时间
+ required: false
+ default: ''
+ - name: location
+ type: string
+ description:
+ zh: 发生位置
+ required: false
+ default: ''
+ - name: status
+ type: string
+ description:
+ zh: 状态描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业安全事故调查专家,请从事故调查报告中提取时间线,还原事故发生前后的操作与响应序列。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别事故相关人员(操作工、班组长、安全员、管理人员)
+ - 识别相关设备(泵、电机、阀门、仪表)
+ - 识别操作动作(启动、停止、巡检、维修、发现异常)
+ - 识别环境状态(正常、异常、报警、危险)
+ rules_for_entities:
+ zh:
+ - 每个节点对应一个独立实体
+ - 实体名称与原文保持一致
+ - 人员、设备、设施、岗位、位置等
+ rules_for_relations:
+ zh:
+ - source 和 target 都必须是已知实体列表中的节点
+ - 每个操作动作都必须提取为一条边
+ - 节点名称必须完全匹配
+ - 操作类型:启动、停止、开启、关闭、巡检、检查、排查、维修、检修、保养、发现、识别、报告、操作、使用、触发
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期):
+ - '- "事故前30分钟" → {observation_time} 前30分钟'
+ - '- "当天上午" → {observation_time} 当天上午'
+ - '- "随后" → 接续前一事件'
+ - 精确时间 → 保持原样
+ - 时间缺失 → 留空,不要猜测
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{action}|{target}'
+ relation_members:
+ source: source
+ target: target
+ time_field: timestamp
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({entity_type})'
+ relation_label: '{action} [{timestamp}]'
diff --git a/hyperextract/templates/legacy/presets/industry/spec_parameter_table.yaml b/hyperextract/templates/legacy/presets/industry/spec_parameter_table.yaml
new file mode 100644
index 0000000..780e4ca
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/spec_parameter_table.yaml
@@ -0,0 +1,141 @@
+language: zh
+name: SpecParameterTable
+type: model
+tags:
+- industry
+description:
+ zh: 核心规格表 - 从技术规格书中提取额定功率、材质、尺寸精度等关键技术指标
+output:
+ description: {}
+ fields:
+ - name: equipment_name
+ type: string
+ description:
+ zh: 设备或产品名称(例如:数控加工中心、离心泵、变压器等)
+ required: true
+ default: ''
+ - name: model_number
+ type: string
+ description:
+ zh: 型号或规格代号
+ required: false
+ default: ''
+ - name: manufacturer
+ type: string
+ description:
+ zh: 制造商或供应商
+ required: false
+ default: ''
+ - name: rated_power
+ type: string
+ description:
+ zh: 额定功率(例如:55kW、200kVA、15kW/20kW)
+ required: false
+ default: ''
+ - name: rated_voltage
+ type: string
+ description:
+ zh: 额定电压(例如:380V、10kV、220V)
+ required: false
+ default: ''
+ - name: rated_current
+ type: string
+ description:
+ zh: 额定电流(例如:100A、50Hz)
+ required: false
+ default: ''
+ - name: frequency
+ type: string
+ description:
+ zh: 工作频率(例如:50Hz、60Hz)
+ required: false
+ default: ''
+ - name: material
+ type: string
+ description:
+ zh: 主要材质或材料(例如:不锈钢304、铸铁、铝合金)
+ required: false
+ default: ''
+ - name: dimensions
+ type: string
+ description:
+ zh: 外形尺寸或安装尺寸(例如:2000×1500×1800mm)
+ required: false
+ default: ''
+ - name: weight
+ type: string
+ description:
+ zh: 重量或质量(例如:2500kg、5.8t)
+ required: false
+ default: ''
+ - name: accuracy
+ type: string
+ description:
+ zh: 精度等级或精度指标(例如:±0.01mm、IT7级)
+ required: false
+ default: ''
+ - name: temperature_range
+ type: string
+ description:
+ zh: 工作温度范围(例如:-20℃~50℃、0~80℃)
+ required: false
+ default: ''
+ - name: pressure_range
+ type: string
+ description:
+ zh: 工作压力范围(例如:0~1.6MPa、PN16)
+ required: false
+ default: ''
+ - name: flow_rate
+ type: string
+ description:
+ zh: 流量参数(例如:100m³/h、50L/min)
+ required: false
+ default: ''
+ - name: speed
+ type: string
+ description:
+ zh: 转速或速度(例如:1450rpm、0.5~2m/s)
+ required: false
+ default: ''
+ - name: capacity
+ type: string
+ description:
+ zh: 容量或处理能力(例如:500L、10m³/h)
+ required: false
+ default: ''
+ - name: protection_level
+ type: string
+ description:
+ zh: 防护等级(例如:IP65、IP55)
+ required: false
+ default: ''
+ - name: insulation_class
+ type: string
+ description:
+ zh: 绝缘等级(例如:F级、H级)
+ required: false
+ default: ''
+ - name: other_parameters
+ type: array
+ description:
+ zh: 其他关键技术参数列表(如适用)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业设备技术专家,请从技术规格书中提取所有关键技术参数。
+
+ '
+ rules:
+ zh:
+ - 每个对象对应一个独立的设备或产品,禁止合并
+ - 参数值与原文保持一致
+ - 提取设备名称、型号、制造商
+ - 提取电气参数:额定功率、额定电压、额定电流、频率
+ - 提取物理参数:材质、尺寸、重量、精度
+ - 提取工况参数:温度范围、压力范围、流量、转速
+ - 提取性能参数:容量、防护等级、绝缘等级
+ - 保留原始单位,不要换算
+display:
+ label: '{equipment_name} ({model_number})'
diff --git a/hyperextract/templates/legacy/presets/industry/system_compatibility_graph.yaml b/hyperextract/templates/legacy/presets/industry/system_compatibility_graph.yaml
new file mode 100644
index 0000000..d10eade
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/system_compatibility_graph.yaml
@@ -0,0 +1,94 @@
+language: zh
+name: SystemCompatibilityGraph
+type: hypergraph
+tags:
+- industry
+description:
+ zh: 系统兼容性超图 - 从技术规格书中提取设备与环境、介质的对应关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(例如:离心泵P-101、不锈钢304、高温环境等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类型:设备、材质、介质、环境、连接方式
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 描述(例如:15kW离心泵、适用于清水、适用于常温)
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: nodes
+ type: array
+ description:
+ zh: 参与兼容性关系的节点列表:[设备, 材质/介质/环境1, 材质/介质/环境2, ...]
+ required: true
+ default: ''
+ - name: compatibility_type
+ type: string
+ description:
+ zh: 兼容性类型:材质兼容、介质适用、环境适用、连接匹配
+ required: true
+ default: ''
+ - name: compatibility_note
+ type: string
+ description:
+ zh: 兼容性说明或限制条件(例如:需加装过滤器、建议使用O型圈)
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业设备选型专家,请从技术规格书中提取实体和设备与环境、介质的兼容性关系作为超边。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 识别设备(离心泵、压缩机、阀门、换热器)
+ - 识别材质(不锈钢304、铸铁、铝合金、碳钢)
+ - 识别介质(清水、污水、油品、酸碱溶液)
+ - 识别环境(高温环境、低温环境、防爆区域、腐蚀性环境)
+ - 识别连接方式(法兰连接、螺纹连接、焊接)
+ - 建立设备与材质、介质、环境的兼容性关系
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别设备(离心泵、压缩机、阀门、换热器)
+ - 识别材质(不锈钢304、铸铁、铝合金、碳钢)
+ - 识别介质(清水、污水、油品、酸碱溶液)
+ - 识别环境(高温环境、低温环境、防爆区域、腐蚀性环境)
+ - 识别连接方式(法兰连接、螺纹连接、焊接)
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别设备与材质的兼容性(不锈钢泵适用于清水)
+ - 识别设备与介质的适用性(化工泵适用于酸碱溶液)
+ - 识别设备对环境的要求(防爆电机适用于防爆区域)
+ - 识别连接方式的匹配
+ - 边的 nodes 字段应包含所有参与该兼容性关系的实体
+identifiers:
+ entity_id: name
+ relation_id: '{compatibility_type}_{nodes}'
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{compatibility_type}'
diff --git a/hyperextract/templates/legacy/presets/industry/system_topology_graph.yaml b/hyperextract/templates/legacy/presets/industry/system_topology_graph.yaml
new file mode 100644
index 0000000..6138cea
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/industry/system_topology_graph.yaml
@@ -0,0 +1,100 @@
+language: zh
+name: SystemTopologyGraph
+type: graph
+tags:
+- industry
+description:
+ zh: 系统拓扑图谱 - 提取工厂的厂区、系统、子系统、设备等层级结构
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称(如:A工厂、制造车间A、数控加工系统、冷却系统等)
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 类别:厂区、系统、子系统、设备
+ required: true
+ default: ''
+ - name: function
+ type: string
+ description:
+ zh: 功能描述
+ required: false
+ default: ''
+ - name: capacity
+ type: string
+ description:
+ zh: 容量或规模
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 上级实体名称(厂区或系统)
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 下级实体名称(系统或子系统或设备)
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:包含等
+ required: true
+ default: ''
+guideline:
+ target:
+ zh: '你是一位工业系统架构分析专家,请从文本中提取实体和它们之间的层级关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别厂区(如A工厂、B工厂)
+ - 识别生产系统(如制造车间、加工车间)
+ - 识别子系统(如数控加工系统、冷却系统)
+ - 识别具体设备(如数控加工中心、机械臂、泵等)
+ - 建立上下级的层级包含关系
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 识别厂区名称(如A工厂、B工厂)
+ - 识别生产系统名称(如制造车间、加工车间)
+ - 识别子系统名称(如数控加工系统、冷却系统)
+ - 识别具体设备名称(如数控加工中心、机械臂、泵等)
+ - 为每个实体指定类别(厂区/系统/子系统/设备)
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 识别厂区与系统之间的包含关系
+ - 识别系统与子系统之间的包含关系
+ - 识别子系统与设备之间的包含关系
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/legal/adjudication_logic.yaml b/hyperextract/templates/legacy/presets/legal/adjudication_logic.yaml
new file mode 100644
index 0000000..4f83fc1
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/adjudication_logic.yaml
@@ -0,0 +1,99 @@
+language: zh
+name: AdjudicationLogic
+type: hypergraph
+tags:
+- legal
+description:
+ zh: 裁判逻辑超图 - 建模法官的推理过程
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 要素名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 要素类型:事实认定、法律依据、裁判结论、主旨、证据、其他
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: logic_type
+ type: string
+ description:
+ zh: 推理类型:事实认定、法律适用、因果认定、责任认定、金额计算、其他
+ required: true
+ default: ''
+ - name: participants
+ type: array
+ description:
+ zh: 参与要素名称列表,必须使用已提取节点的 name
+ required: true
+ default: ''
+ - name: reasoning
+ type: string
+ description:
+ zh: 推理过程描述,从事实到结论的逻辑推导
+ required: true
+ default: ''
+ - name: conclusion
+ type: string
+ description:
+ zh: 推理结论
+ required: false
+ default: ''
+ - name: source_clause
+ type: string
+ description:
+ zh: 裁判文书的章节位置
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的法律工作者,请从裁判文书中提取裁判要素和裁判逻辑。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
+ - 要素名称与原文保持一致
+ - 仅从已提取节点中提取边,不要创建新名称
+ - 超边必须包含 logic_type, participants, reasoning
+ - participants 应包含涉及的事实认定、法律依据、裁判结论等要素
+ - 要素类型:事实认定(法院认定的案件事实)、法律依据(适用的法律条文、司法解释等)、裁判结论(判决结果或裁定结果)、主旨(裁判的核心观点或要旨)、证据(用于证明事实的证据材料)、其他(不属于上述类别的要素)
+ - 推理类型:事实认定(从证据推导出事实)、法律适用(将法律适用于事实)、因果认定(认定行为与结果之间的因果关系)、责任认定(认定责任主体和责任大小)、金额计算(计算赔偿金额或标的金额)、其他(不属于上述类别的推理)
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
+ - 要素名称与原文保持一致
+ - 提取裁判文书中涉及的要素作为节点
+ - 为每个要素指定类型
+ - 为每个要素添加简要描述(1-2句话)
+ rules_for_relations:
+ zh:
+ - participants 必须严格使用已知裁判要素列表中的名称,不要创建新名称
+ - 超边必须包含 logic_type, participants, reasoning
+ - participants 应包含涉及的事实认定、法律依据、裁判结论等要素
+ - reasoning 描述从事实到结论的逻辑推导过程
+identifiers:
+ entity_id: name
+ relation_id: '{logic_type}_{participants}'
+ relation_members: participants
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '[{logic_type}] {conclusion}'
diff --git a/hyperextract/templates/legacy/presets/legal/beneficial_ownership_graph.yaml b/hyperextract/templates/legacy/presets/legal/beneficial_ownership_graph.yaml
new file mode 100644
index 0000000..881ac68
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/beneficial_ownership_graph.yaml
@@ -0,0 +1,105 @@
+language: zh
+name: BeneficialOwnershipGraph
+type: graph
+tags:
+- legal
+description:
+ zh: 受益所有权图谱 - 穿透多层股权结构,识别最终受益人和控制人
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: entity_name
+ type: string
+ description:
+ zh: 实体名称,如公司名、人名
+ required: true
+ default: ''
+ - name: entity_type
+ type: string
+ description:
+ zh: 实体类型:公司、自然人、基金、合伙企业、境外特殊目的公司
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述,如持股比例、职务
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体名称
+ required: true
+ default: ''
+ - name: relation_type
+ type: string
+ description:
+ zh: 关系类型:控股、参股、担任董事、执行事务合伙人、实际控制、配偶关系等
+ required: true
+ default: ''
+ - name: shareholding_ratio
+ type: string
+ description:
+ zh: 持股比例或出资比例,如35%、1%、XX%
+ required: false
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 关系描述,如通过多层持股结构控制
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的反洗钱合规专员,请从文本中提取股权结构和受益所有权信息。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 实体类型:公司、自然人、基金、合伙企业、境外特殊目的公司
+ - 包含股东、合伙人、高管、实际控制人等
+ - 关系类型:控股(持有50%以上股份或出资额)、参股(持有一定比例股份但不构成控股)、担任董事(在公司担任董事职务)、执行事务合伙人(执行合伙事务)、实际控制(通过协议或其他安排实现实际控制)、配偶关系(夫妻关系)、其他关系(如父子、兄弟、姐妹等)
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 实体类型:公司、自然人、基金、合伙企业、境外特殊目的公司
+ - 包含股东、合伙人、高管、实际控制人等
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 控股:持有50%以上股份或出资额
+ - 参股:持有一定比例股份但不构成控股
+ - 担任董事:在公司担任董事职务
+ - 执行事务合伙人:执行合伙事务
+ - 实际控制:通过协议或其他安排实现实际控制
+ - 配偶关系:夫妻关系
+ - 其他关系:如父子、兄弟、姐妹等
+identifiers:
+ entity_id: entity_name
+ relation_id: '{source}|{relation_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{entity_name}({entity_type})'
+ relation_label: '{relation_type} {shareholding_ratio}'
diff --git a/hyperextract/templates/legacy/presets/legal/case_fact_timeline.yaml b/hyperextract/templates/legacy/presets/legal/case_fact_timeline.yaml
new file mode 100644
index 0000000..74ab74c
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/case_fact_timeline.yaml
@@ -0,0 +1,109 @@
+language: zh
+name: CaseFactTimeline
+type: temporal_graph
+tags:
+- legal
+description:
+ zh: 案件事实时序图 - 展示法律关系的变化过程
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如原告、被告、合同、金钱、股权等
+ required: true
+ default: ''
+ - name: entity_type
+ type: string
+ description:
+ zh: 实体类型:当事人、合同/协议、金钱、股权、证物、其他
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体名称
+ required: true
+ default: ''
+ - name: event
+ type: string
+ description:
+ zh: 法律行为或事件,如签订协议、支付投资款、分配红利、提起诉讼等
+ required: true
+ default: ''
+ - name: time_info
+ type: string
+ description:
+ zh: 时间信息,统一格式为年-月-日(如2021-03-15)或年月(如2021-03)
+ required: false
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 事件详细描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的法律工作者,请从文本中提取案件相关的法律实体以及它们之间的法律行为。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 实体类型:当事人(原告、被告、第三人、法定代表人、委托诉讼代理人)、合同/协议(战略合作协议、补充协议、收益分配说明函等)、金钱(投资款、红利、违约金等)、股权(股份、股权等)
+ - 法律行为:签订协议、支付投资款、完成登记、召开股东会、分配红利、发送函件、提起诉讼等
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 实体类型:当事人、合同/协议、金钱、股权、证物、其他
+ - 当事人:原告、被告、第三人、法定代表人、委托诉讼代理人
+ - 合同/协议:战略合作协议、补充协议、收益分配说明函等
+ - 金钱:投资款、红利、违约金等
+ - 股权:股份、股权等
+ rules_for_relations:
+ zh:
+ - 仅从已知法律实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 常见的法律行为:签订协议、支付投资款、完成登记、召开股东会、分配红利、发送函件、提起诉讼等
+ - 每个边表示一个法律行为,连接相关实体
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期)
+ - 精确时间 → 转换为标准格式年-月-日
+ - 时间缺失 → 留空
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{event}|{target}'
+ relation_members:
+ source: source
+ target: target
+ time_field: time_info
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name}({entity_type})'
+ relation_label: '{event} [{time_info}]'
diff --git a/hyperextract/templates/legacy/presets/legal/case_law_citation_net.yaml b/hyperextract/templates/legacy/presets/legal/case_law_citation_net.yaml
new file mode 100644
index 0000000..7902203
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/case_law_citation_net.yaml
@@ -0,0 +1,104 @@
+language: zh
+name: CaseLawCitationNet
+type: graph
+tags:
+- legal
+description:
+ zh: 判例引用网络 - 映射案件之间的引用、先例区分或先例推翻关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: case_name
+ type: string
+ description:
+ zh: 判例名称,如指导案例140号、(2020)最高法民终字第XX号
+ required: true
+ default: ''
+ - name: case_type
+ type: string
+ description:
+ zh: 案件类型:指导案例、公报案例、普通案例、司法解释、法律条文
+ required: true
+ default: ''
+ - name: court
+ type: string
+ description:
+ zh: 审理法院
+ required: false
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 案件简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源判例名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标判例名称
+ required: true
+ default: ''
+ - name: citation_type
+ type: string
+ description:
+ zh: 引用类型:引用、依据、先例区分、先例推翻、参考、类案
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 引用关系描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的法学专家,请从文本中提取所有判例以及它们之间的引用或关联关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的判例,禁止将多个判例合并为一个节点
+ - 判例名称与原文保持一致
+ - 仅从已知判例列表中提取边,不要创建未列出的判例
+ - 关系描述应与原文保持一致
+ - 案件类型:指导案例、公报案例、普通案例、司法解释、法律条文
+ - 常见表达:"根据《民法典》第X条"、"指导案例XX号"、"本案确立了..."
+ - 关系类型:引用(后案引用前案作为裁判依据)、依据(后案以前案确立的规则为法律依据)、先例区分(后案认为前案与本案情形不同,不适用前案规则)、先例推翻(后案推翻前案确立的规则)、参考(后案参考前案的裁判思路)、类案(后案与前案属于同类案件)
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的判例,禁止将多个判例合并为一个节点
+ - 判例名称与原文保持一致
+ - 案件类型:指导案例、公报案例、普通案例、司法解释、法律条文
+ - 常见表达:"根据《民法典》第X条"、"指导案例XX号"、"本案确立了..."
+ rules_for_relations:
+ zh:
+ - 仅从已知判例列表中提取边,不要创建未列出的判例
+ - 关系描述应与原文保持一致
+ - 引用:后案引用前案作为裁判依据
+ - 依据:后案以前案确立的规则为法律依据
+ - 先例区分:后案认为前案与本案情形不同,不适用前案规则
+ - 先例推翻:后案推翻前案确立的规则
+ - 参考:后案参考前案的裁判思路
+ - 类案:后案与前案属于同类案件
+identifiers:
+ entity_id: case_name
+ relation_id: '{source}|{citation_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{case_name}({case_type})'
+ relation_label: '{citation_type}'
diff --git a/hyperextract/templates/legacy/presets/legal/compliance_requirement_list.yaml b/hyperextract/templates/legacy/presets/legal/compliance_requirement_list.yaml
new file mode 100644
index 0000000..2ca2fc1
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/compliance_requirement_list.yaml
@@ -0,0 +1,69 @@
+language: zh
+name: ComplianceRequirementList
+type: list
+tags:
+- legal
+description:
+ zh: 合规要求清单 - 从法规或政策文件中提取合规义务
+output:
+ description: {}
+ fields:
+ - name: requirement_type
+ type: string
+ description:
+ zh: 要求类型:许可要求、报告要求、披露要求、禁止性规定、程序性要求、其他
+ required: true
+ default: ''
+ - name: requirement_title
+ type: string
+ description:
+ zh: 要求标题或简要名称
+ required: true
+ default: ''
+ - name: content
+ type: string
+ description:
+ zh: 要求的具体内容
+ required: true
+ default: ''
+ - name: responsible_entity
+ type: string
+ description:
+ zh: 责任主体或适用对象
+ required: false
+ default: ''
+ - name: deadline
+ type: string
+ description:
+ zh: 履行期限或截止日期
+ required: false
+ default: ''
+ - name: penalty
+ type: string
+ description:
+ zh: 违规后果或处罚措施
+ required: false
+ default: ''
+ - name: source_clause
+ type: string
+ description:
+ zh: 来源条款编号或章节
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的合规顾问,请从法规或政策文件中提取所有合规义务。
+
+ '
+ rules:
+ zh:
+ - 提取文本中所有合规要求或义务
+ - 为每一项要求指定类型:许可要求、报告要求、披露要求、禁止性规定、程序性要求、其他
+ - 记录要求的具体内容、责任主体、履行期限
+ - 记录违规后果或处罚措施
+ - 记录来源条款编号
+ - 每项合规要求作为独立条目提取
+ - 保持要求内容与原文一致
+ - 不要遗漏任何合规要求
+display:
+ label: '[{requirement_type}] {requirement_title}'
diff --git a/hyperextract/templates/legacy/presets/legal/contract_obligation_hypergraph.yaml b/hyperextract/templates/legacy/presets/legal/contract_obligation_hypergraph.yaml
new file mode 100644
index 0000000..0e81e6d
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/contract_obligation_hypergraph.yaml
@@ -0,0 +1,105 @@
+language: zh
+name: ContractObligationHypergraph
+type: hypergraph
+tags:
+- legal
+description:
+ zh: 合同义务超图 - 建模复杂的条件性义务
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 要素名称,文本中出现的精确名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 要素类型:主体、义务、触发条件、例外情形、违约责任、其他
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: obligation_type
+ type: string
+ description:
+ zh: 义务类型:支付义务、交付义务、保密义务、竞业限制、售后服务、其他
+ required: true
+ default: ''
+ - name: participants
+ type: array
+ description:
+ zh: 参与要素名称列表,必须使用已提取节点的 name
+ required: true
+ default: ''
+ - name: trigger_condition
+ type: string
+ description:
+ zh: 触发条件,如合同签订后、验收合格后、违约发生时等
+ required: false
+ default: ''
+ - name: exception
+ type: string
+ description:
+ zh: 例外情形,如不可抗力、对方违约在先等
+ required: false
+ default: ''
+ - name: liability
+ type: string
+ description:
+ zh: 违约责任,如支付违约金、赔偿损失、解除合同等
+ required: false
+ default: ''
+ - name: source_clause
+ type: string
+ description:
+ zh: 义务来源条款编号或名称
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的合同法律师,请从文本中提取合同要素和合同义务。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
+ - 要素名称与原文保持一致
+ - 仅从已提取节点中提取边,不要创建新名称
+ - 超边必须包含 obligation_type, participants
+ - participants 应包含涉及的主体、义务及相关要素
+ - 要素类型:主体(合同的当事人)、义务(具体需要执行的行为)、触发条件(义务生效或履行的前提条件)、例外情形(义务免除或减轻的情形)、违约责任(违反义务的后果)、其他(不属于上述类别的要素)
+ - 义务类型:支付义务、交付义务、保密义务、竞业限制、售后服务、其他
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
+ - 要素名称与原文保持一致
+ - 提取合同中涉及的要素作为节点
+ - 为每个要素指定类型
+ - 为每个要素添加简要描述(1-2句话)
+ rules_for_relations:
+ zh:
+ - participants 必须严格使用已知合同要素列表中的名称,不要创建新名称
+ - 超边必须包含 obligation_type, participants
+ - participants 应包含涉及的主体、义务及相关要素
+ - 义务类型:支付义务、交付义务、保密义务、竞业限制、售后服务、其他
+identifiers:
+ entity_id: name
+ relation_id: '{obligation_type}_{participants}'
+ relation_members: participants
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{obligation_type}'
diff --git a/hyperextract/templates/legacy/presets/legal/defined_term_registry.yaml b/hyperextract/templates/legacy/presets/legal/defined_term_registry.yaml
new file mode 100644
index 0000000..713c2ab
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/defined_term_registry.yaml
@@ -0,0 +1,47 @@
+language: zh
+name: DefinedTermRegistry
+type: set
+tags:
+- legal
+description:
+ zh: 术语定义表 - 去重并汇总合同中定义的所有专有名词
+output:
+ description: {}
+ fields:
+ - name: term
+ type: string
+ description:
+ zh: 术语名称,如机密信息、不可抗力、项目
+ required: true
+ default: ''
+ - name: definition
+ type: string
+ description:
+ zh: 术语的定义说明
+ required: true
+ default: ''
+ - name: source_clause
+ type: string
+ description:
+ zh: 定义来源的条款编号
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的合同法律师,请从文本中提取所有定义的术语,形成术语定义表。
+
+ '
+ rules:
+ zh:
+ - 识别合同中用引号或黑体定义的专有名词(如"机密信息"、"不可抗力")
+ - 提取术语的定义说明
+ - 记录定义出现的条款位置
+ - 去重:同一术语只保留一条记录
+ - 术语名称必须与原文保持一致(包括引号)
+ - 仅提取真正被定义的术语,不要提取普通业务词汇
+ - 保持客观准确,不添加文本中没有的信息
+ - 术语类型:合同标的相关的术语(项目、软件产品、技术文档)、权利义务相关的术语(投资款、服务费、违约金)、风险相关的术语(不可抗力、机密信息)、程序相关的术语(验收标准、付款条件)
+identifiers:
+ item_id: term
+display:
+ label: '{term}'
diff --git a/hyperextract/templates/legacy/presets/legal/legal_concept_ontology.yaml b/hyperextract/templates/legacy/presets/legal/legal_concept_ontology.yaml
new file mode 100644
index 0000000..74716c5
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/legal_concept_ontology.yaml
@@ -0,0 +1,97 @@
+language: zh
+name: LegalConceptOntology
+type: graph
+tags:
+- legal
+description:
+ zh: 法律概念本体 - 提取法律术语的定义、上下位关系及法理阐释
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 法律概念名称,如过错、故意、过失、违法性
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 概念类型:原则、规则、学说、术语、法律依据
+ required: true
+ default: ''
+ - name: definition
+ type: string
+ description:
+ zh: 概念的简要定义
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源概念名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标概念名称
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:上位概念、下位概念、相关联、对立、包含、依据
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 关系描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的法学专家,请从文本中提取所有法律概念以及它们之间的关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的概念,禁止将多个概念合并为一个节点
+ - 概念名称与原文保持一致
+ - 仅从已知概念列表中提取边,不要创建未列出的概念
+ - 关系描述应与原文保持一致
+ - 法律概念类型包括:原则、规则、学说、术语、法律依据
+ - 关系类型:上位概念、下位概念、相关联、对立、包含、依据
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的概念,禁止将多个概念合并为一个节点
+ - 概念名称与原文保持一致
+ - 法律概念类型包括:原则、规则、学说、术语、法律依据
+ - 常见的法律概念:过错、故意、过失、违法性、因果关系、举证责任等
+ rules_for_relations:
+ zh:
+ - 仅从已知法律概念列表中提取边,不要创建未列出的概念
+ - 关系描述应与原文保持一致
+ - 上位概念:概念之间的层级包含关系
+ - 下位概念:概念之间的层级包含关系
+ - 相关联:概念之间存在逻辑关联
+ - 对立:概念之间存在对立关系
+ - 包含:一个概念包含另一个概念
+ - 依据:一个概念是另一个概念的依据
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name}({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/legal/liability_clause_list.yaml b/hyperextract/templates/legacy/presets/legal/liability_clause_list.yaml
new file mode 100644
index 0000000..f1c1902
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/liability_clause_list.yaml
@@ -0,0 +1,57 @@
+language: zh
+name: LiabilityClauseList
+type: list
+tags:
+- legal
+description:
+ zh: 责任条款清单 - 提取关于赔偿、责任限制、保证及免责声明的具体条款
+output:
+ description: {}
+ fields:
+ - name: clause_type
+ type: string
+ description:
+ zh: 条款类型:赔偿条款、责任限制、保证条款、免责声明、违约金、连带责任、其他
+ required: true
+ default: ''
+ - name: clause_title
+ type: string
+ description:
+ zh: 条款标题或简要名称
+ required: true
+ default: ''
+ - name: content
+ type: string
+ description:
+ zh: 条款的具体内容
+ required: true
+ default: ''
+ - name: liability_amount
+ type: string
+ description:
+ zh: 涉及的责任金额或计算方式,如合同总价的10%、人民币20万元等
+ required: false
+ default: ''
+ - name: source_clause
+ type: string
+ description:
+ zh: 条款来源的章节编号
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的合同法律师,请从文本中提取所有关于责任、赔偿、保证的条款。
+
+ '
+ rules:
+ zh:
+ - 提取文本中所有关于责任分配的具体条款
+ - 为每一条款指定类型:赔偿条款、责任限制、保证条款、免责声明、违约金、连带责任、其他
+ - 记录条款的具体内容和涉及的责任金额
+ - 记录条款来源的章节编号
+ - 条款类型说明:赔偿条款(约定一方给另一方造成损失时的赔偿方式)、责任限制(限制某方承担责任的最高限额)、保证条款(一方对某事项的保证承诺)、免责声明(免除或限制某方责任的条款)、违约金(约定违约时支付的违约金)、连带责任(约定多方承担连带责任)、其他(不属于上述类别的责任条款)
+ - 每项责任条款作为独立条目提取
+ - 保持条款内容与原文一致
+ - 不要遗漏任何责任相关条款
+display:
+ label: '[{clause_type}] {clause_title}'
diff --git a/hyperextract/templates/legacy/presets/legal/litigation_participant_map.yaml b/hyperextract/templates/legacy/presets/legal/litigation_participant_map.yaml
new file mode 100644
index 0000000..ed199b7
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/legal/litigation_participant_map.yaml
@@ -0,0 +1,91 @@
+language: zh
+name: LitigationParticipantMap
+type: graph
+tags:
+- legal
+description:
+ zh: 诉讼参与人图谱 - 提取原告、被告、第三人、代理律师及证人之间的关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 参与人姓名或名称
+ required: true
+ default: ''
+ - name: participant_type
+ type: string
+ description:
+ zh: 参与人类型:原告、被告、第三人、委托诉讼代理人、法定代理人、证人、鉴定人、法官、合议庭成员
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 参与人角色描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源参与人姓名或名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标参与人姓名或名称
+ required: true
+ default: ''
+ - name: relation_type
+ type: string
+ description:
+ zh: 关系类型:代理、代表、股东、董事、担保、上下级、同案当事人、敌对
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 关系描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的法律文书分析师,请从文本中提取诉讼参与人及其之间的关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的参与人,禁止将多个参与人合并为一个节点
+ - 参与人名称与原文保持一致
+ - 仅从已知参与人列表中提取边,不要创建未列出的参与人
+ - 关系描述应与原文保持一致
+ - 参与人类型:原告、被告、第三人、委托诉讼代理人、法定代理人、证人、鉴定人、法官、合议庭成员
+ - 关系类型:代理、代表、股东、董事、担保、上下级、同案当事人、敌对
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的参与人,禁止将多个参与人合并为一个节点
+ - 参与人名称与原文保持一致
+ - 参与人类型:原告、被告、第三人、委托诉讼代理人、法定代理人、证人、鉴定人、法官、合议庭成员
+ rules_for_relations:
+ zh:
+ - 仅从已知参与人列表中提取边,不要创建未列出的参与人
+ - 关系描述应与原文保持一致
+ - 关系类型:代理、代表、股东、董事、担保、上下级、同案当事人、敌对
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relation_type}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({participant_type})'
+ relation_label: '{relation_type}'
diff --git a/hyperextract/templates/legacy/presets/medicine/adverse_reaction_stats.yaml b/hyperextract/templates/legacy/presets/medicine/adverse_reaction_stats.yaml
new file mode 100644
index 0000000..352c485
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/adverse_reaction_stats.yaml
@@ -0,0 +1,43 @@
+language: zh
+name: AdverseReactionStats
+type: list
+tags:
+- medicine
+description:
+ zh: 不良反应统计 - 提取各系统的不良反应表现及其发生率描述
+output:
+ description: {}
+ fields:
+ - name: system
+ type: string
+ description:
+ zh: 系统名称,如胃肠道、全身、皮肤等
+ - name: reaction
+ type: string
+ description:
+ zh: 不良反应表现
+ - name: incidence
+ type: string
+ description:
+ zh: 发生率
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的临床药师,请从文本中提取各系统的不良反应表现及其发生率描述,构建不良反应统计。
+
+ '
+ rules:
+ zh:
+ - 提取所有不良反应,包括系统名称、不良反应表现和发生率
+ - 为每个不良反应添加详细描述(如果文本中提供)
+ - 保持不良反应表现与原文一致
+ rules_for_entities:
+ zh:
+ - '- 不良反应名称保持原文'
+ - '- 发生率表示法保持原文,如 5.2%、常见、罕见'
+display:
+ label: '{system}: {reaction} ({incidence})'
diff --git a/hyperextract/templates/legacy/presets/medicine/anatomy_hierarchy.yaml b/hyperextract/templates/legacy/presets/medicine/anatomy_hierarchy.yaml
new file mode 100644
index 0000000..3790668
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/anatomy_hierarchy.yaml
@@ -0,0 +1,75 @@
+language: zh
+name: AnatomyHierarchy
+type: graph
+tags:
+- medicine
+description:
+ zh: 解剖层级树 - 构建解剖位置的包含和毗邻关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 解剖结构名称,如器官、组织、血管等
+ - name: category
+ type: string
+ description:
+ zh: 解剖类型:器官、组织、血管、神经、骨骼等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源解剖结构
+ - name: target
+ type: string
+ description:
+ zh: 目标解剖结构
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:包含、毗邻、分支、供应等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的解剖学家,请从文本中提取解剖结构及其关系,构建解剖层级树。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ rules_for_entities:
+ zh:
+ - '- 解剖学术语保持原文,如解剖结构名称(心脏、肝脏、主动脉)'
+ rules_for_relations:
+ zh:
+ - '- 包含:解剖结构之间的包含关系'
+ - '- 毗邻:解剖结构之间的相邻关系'
+ - '- 分支:血管或神经的分支关系'
+ - '- 供应:血管供应区域的关系'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/medicine/clinical_pathway.yaml b/hyperextract/templates/legacy/presets/medicine/clinical_pathway.yaml
new file mode 100644
index 0000000..d40f463
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/clinical_pathway.yaml
@@ -0,0 +1,73 @@
+language: zh
+name: ClinicalPathway
+type: graph
+tags:
+- medicine
+description:
+ zh: 临床路径图 - 提取 '如果症状A则检查B否则治疗C' 的决策树结构
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 节点名称,如症状、检查、治疗等
+ - name: category
+ type: string
+ description:
+ zh: 节点类型:症状、检查、治疗、诊断、决策点等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源节点
+ - name: target
+ type: string
+ description:
+ zh: 目标节点
+ - name: condition
+ type: string
+ description:
+ zh: 条件描述,如如果症状A则
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的临床医生,请从文本中提取"如果症状A则检查B否则治疗C"的决策树结构,构建临床路径图。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ rules_for_entities:
+ zh:
+ - '- 医学专业术语保持原文,如检查项目名称、药物名称'
+ - '- 临床术语保持原文,如心电图、血常规'
+ rules_for_relations:
+ zh:
+ - '- 条件描述应清晰表达决策逻辑'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{condition}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{condition}'
diff --git a/hyperextract/templates/legacy/presets/medicine/complex_interaction_net.yaml b/hyperextract/templates/legacy/presets/medicine/complex_interaction_net.yaml
new file mode 100644
index 0000000..46a6f30
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/complex_interaction_net.yaml
@@ -0,0 +1,72 @@
+language: zh
+name: ComplexInteractionNet
+type: hypergraph
+tags:
+- medicine
+description:
+ zh: 条件性相互作用网 - 建模 '药A+药B+特定体质 -> 不良反应' 的高阶依赖
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如药物、体质、不良反应等
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:药物、体质、不良反应、其他等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述,如药物的功能、作用等
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 超边名称,如药物相互作用
+ - name: nodes
+ type: array
+ description:
+ zh: 参与超边的节点列表
+ - name: interactionType
+ type: string
+ description:
+ zh: 相互作用类型:增强、减弱、不良反应等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述,如具体的相互作用机制
+guideline:
+ target:
+ zh: '你是一位专业的临床药师,请从文本中提取药物相互作用信息,构建条件性相互作用网。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ rules_for_entities:
+ zh:
+ - '- 药物名称保持原文,如二甲双胍、磺酰脲类'
+ - '- 不良反应名称保持原文'
+ rules_for_relations:
+ zh:
+ - '- 增强:药物作用相互增强'
+ - '- 减弱:药物作用相互减弱'
+ - '- 不良反应:药物组合导致不良反应'
+identifiers:
+ entity_id: name
+ relation_id: name
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: name
diff --git a/hyperextract/templates/legacy/presets/medicine/contraindication_list.yaml b/hyperextract/templates/legacy/presets/medicine/contraindication_list.yaml
new file mode 100644
index 0000000..e325bd5
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/contraindication_list.yaml
@@ -0,0 +1,40 @@
+language: zh
+name: ContraindicationList
+type: list
+tags:
+- medicine
+description:
+ zh: 禁忌症清单 - 提取绝对禁忌(如孕妇、严重肾衰竭等)的明确列表
+output:
+ description: {}
+ fields:
+ - name: contraindication
+ type: string
+ description:
+ zh: 禁忌症描述
+ - name: contraindicationType
+ type: string
+ description:
+ zh: 禁忌症类型:绝对禁忌、相对禁忌等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的临床药师,请从文本中提取绝对禁忌(如孕妇、严重肾衰竭等)的明确列表,构建禁忌症清单。
+
+ '
+ rules:
+ zh:
+ - 提取所有禁忌症,包括绝对禁忌和相对禁忌
+ - 为每个禁忌症指定类型:绝对禁忌、相对禁忌等
+ - 为每个禁忌症添加详细描述(如果文本中提供)
+ - 保持禁忌症描述与原文一致
+ rules_for_entities:
+ zh:
+ - '- 禁忌症名称保持原文'
+ - '- 医学术语保持原文'
+display:
+ label: '{contraindication} ({contraindicationType})'
diff --git a/hyperextract/templates/legacy/presets/medicine/discharge_instruction.yaml b/hyperextract/templates/legacy/presets/medicine/discharge_instruction.yaml
new file mode 100644
index 0000000..a844e30
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/discharge_instruction.yaml
@@ -0,0 +1,58 @@
+language: zh
+name: DischargeInstruction
+type: model
+tags:
+- medicine
+description:
+ zh: 出院医嘱摘要 - 提取出院带药、复诊计划及康复建议的结构化信息
+output:
+ description: {}
+ fields:
+ - name: medications
+ type: array
+ description:
+ zh: 出院带药列表,每个药物包含名称、剂量、用法、频次等信息
+ required: false
+ - name: followUp
+ type: array
+ description:
+ zh: 复诊计划列表,每个复诊包含时间、科室、检查项目等信息
+ required: false
+ - name: rehabilitation
+ type: array
+ description:
+ zh: 康复建议列表
+ required: false
+ - name: diet
+ type: array
+ description:
+ zh: 饮食建议列表
+ required: false
+ - name: activity
+ type: array
+ description:
+ zh: 活动建议列表
+ required: false
+ - name: notes
+ type: array
+ description:
+ zh: 其他注意事项列表
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的医生,请从文本中提取出院带药、复诊计划及康复建议的结构化信息,构建出院医嘱摘要。
+
+ '
+ rules:
+ zh:
+ - 提取所有出院带药信息,每个药物包含名称、剂量、用法、频次等信息
+ - 提取所有复诊计划信息,每个复诊包含时间、科室、检查项目等信息
+ - 提取所有康复建议、饮食建议、活动建议和其他注意事项
+ - 保持信息与原文一致
+ rules_for_entities:
+ zh:
+ - '- 药物名称保持原文,如阿司匹林、二甲双胍'
+ - '- 剂量单位保持原文,如 mg、ml'
+ - '- 医学缩写保持原文,如 qd(每日一次)、bid(每日两次)'
+display:
+ label: 出院医嘱摘要
diff --git a/hyperextract/templates/legacy/presets/medicine/hospital_course_timeline.yaml b/hyperextract/templates/legacy/presets/medicine/hospital_course_timeline.yaml
new file mode 100644
index 0000000..03101e6
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/hospital_course_timeline.yaml
@@ -0,0 +1,89 @@
+language: zh
+name: HospitalCourseTimeline
+type: temporal_graph
+tags:
+- medicine
+description:
+ zh: 住院病程时间轴 - 严格按时间顺序提取入院、检查、治疗、转归等节点
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 节点名称,如入院、检查、治疗、转归等
+ - name: category
+ type: string
+ description:
+ zh: 节点类型:入院、检查、治疗、手术、转归、其他等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源节点
+ - name: target
+ type: string
+ description:
+ zh: 目标节点
+ - name: eventType
+ type: string
+ description:
+ zh: 事件类型:入院、检查、治疗、手术、转归等
+ - name: eventDate
+ type: string
+ description:
+ zh: 事件日期,格式为年-月-日
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的医院管理人员,请从文本中严格按时间顺序提取入院、检查、治疗、转归等节点,构建住院病程时间轴。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ rules_for_entities:
+ zh:
+ - '- 医学术语保持原文'
+ rules_for_relations:
+ zh:
+ - '- 记录事件之间的时间顺序关系'
+ rules_for_time:
+ zh:
+ - 当前观察日期:{observation_time}
+ - 相对时间解析(基于观察日期):
+ - '- "去年" → {observation_time} 的前一年'
+ - '- "上月" → {observation_time} 的前一个月'
+ - '- "本季度" → {observation_time} 所在季度'
+ - '- "近期" → {observation_time} 最近 3 个月'
+ - '- "入院当天" → 使用入院日期'
+ - '- "术后第一天" → 手术日期的后一天'
+ - 精确时间 → 保持原样
+ - 时间缺失 → 留空,不要猜测
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{eventType}|{target}'
+ relation_members:
+ source: source
+ target: target
+ time_field: eventDate
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{eventType} ({eventDate})'
diff --git a/hyperextract/templates/legacy/presets/medicine/level_of_evidence.yaml b/hyperextract/templates/legacy/presets/medicine/level_of_evidence.yaml
new file mode 100644
index 0000000..7f32f01
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/level_of_evidence.yaml
@@ -0,0 +1,54 @@
+language: zh
+name: LevelOfEvidence
+type: list
+tags:
+- medicine
+description:
+ zh: 证据评级表 - 提取指南中的具体推荐意见及其对应的证据等级
+output:
+ description: {}
+ fields:
+ - name: topic
+ type: string
+ description:
+ zh: 推荐主题,如血糖控制、血脂管理、阿司匹林使用等
+ - name: summary
+ type: string
+ description:
+ zh: 推荐意见摘要,简短概括该推荐的核心内容,不超过10字
+ - name: recommendation
+ type: string
+ description:
+ zh: 推荐意见
+ - name: evidenceLevel
+ type: string
+ description:
+ zh: 证据等级,如A、B、C、1a、1b等
+ - name: recommendationLevel
+ type: string
+ description:
+ zh: 推荐级别,如强推荐、弱推荐等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的循证医学专家,请从文本中提取指南中的具体推荐意见及其对应的证据等级,构建证据评级表。
+
+ '
+ rules:
+ zh:
+ - 提取所有推荐意见及其对应的证据等级
+ - 为每个推荐意见指定推荐主题(topic)
+ - 为每个推荐意见提取摘要(summary),不超过10字
+ - 为每个推荐意见指定推荐级别
+ - 为每个推荐意见添加详细描述(如果文本中提供)
+ - 保持推荐意见与原文一致
+ rules_for_entities:
+ zh:
+ - '- 证据等级保持原文,如 A、B、C、1a、1b'
+ - '- 医学术语保持原文'
+display:
+ label: '{topic} [{evidenceLevel}]'
diff --git a/hyperextract/templates/legacy/presets/medicine/medical_concept_net.yaml b/hyperextract/templates/legacy/presets/medicine/medical_concept_net.yaml
new file mode 100644
index 0000000..873b6c6
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/medical_concept_net.yaml
@@ -0,0 +1,79 @@
+language: zh
+name: MedicalConceptNet
+type: graph
+tags:
+- medicine
+description:
+ zh: 医学概念网络 - 提取医学术语及其关联属性(如:属于、定义为)
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 概念名称,如医学术语、疾病名称、解剖部位等
+ - name: category
+ type: string
+ description:
+ zh: 概念类型:疾病、解剖部位、生理过程、药物、症状、体征等
+ - name: definition
+ type: string
+ description:
+ zh: 概念定义
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源概念
+ - name: target
+ type: string
+ description:
+ zh: 目标概念
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:属于、定义为、包含、组成、位于、导致、治疗等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的医学术语专家,请从文本中提取医学术语及其关联属性,构建医学概念网络。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ rules_for_entities:
+ zh:
+ - '- 医学术语保持原文,如疾病名称、解剖部位名称'
+ - '- 专业缩写保持原文,如 ECG、CT、MRI'
+ rules_for_relations:
+ zh:
+ - '- 属于:概念归属关系'
+ - '- 定义为:概念定义关系'
+ - '- 包含:包含关系'
+ - '- 组成:组成关系'
+ - '- 位于:位置关系'
+ - '- 导致:因果关系'
+ - '- 治疗:治疗关系'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/medicine/microscopic_feature_set.yaml b/hyperextract/templates/legacy/presets/medicine/microscopic_feature_set.yaml
new file mode 100644
index 0000000..f5326dc
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/microscopic_feature_set.yaml
@@ -0,0 +1,45 @@
+language: zh
+name: MicroscopicFeatureSet
+type: set
+tags:
+- medicine
+description:
+ zh: 微观特征集 - 提取免疫组化指标(如 HER2+, Ki67)及基因突变状态
+output:
+ description: {}
+ fields:
+ - name: featureName
+ type: string
+ description:
+ zh: 特征名称,如免疫组化指标、基因突变等
+ - name: featureType
+ type: string
+ description:
+ zh: 特征类型:免疫组化、基因突变、其他等
+ - name: value
+ type: string
+ description:
+ zh: 特征值,如阳性、阴性、百分比等
+ - name: description
+ type: string
+ description:
+ zh: 特征描述
+ required: false
+guideline:
+ target:
+ zh: '你是一位专业的病理学家,请从文本中提取免疫组化指标(如 HER2+, Ki67)及基因突变状态,构建微观特征集。
+
+ '
+ rules:
+ zh:
+ - 提取所有免疫组化指标和基因突变状态
+ - 为每个特征指定类型:免疫组化、基因突变、其他等
+ - 为每个特征添加特征值,如阳性、阴性、百分比等
+ - 为每个特征添加简要描述(如果文本中提供)
+ - 保持特征名称与原文一致
+ rules_for_entities:
+ zh:
+ - '- 免疫组化指标保持原文,如 HER2、Ki67、ER、PR'
+ - '- 基因突变名称保持原文,如 BRCA1、KRAS、TP53'
+display:
+ label: '{featureName} ({featureType})'
diff --git a/hyperextract/templates/legacy/presets/medicine/pathology_hypergraph.yaml b/hyperextract/templates/legacy/presets/medicine/pathology_hypergraph.yaml
new file mode 100644
index 0000000..f2ac83d
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/pathology_hypergraph.yaml
@@ -0,0 +1,77 @@
+language: zh
+name: PathologyHypergraph
+type: hypergraph
+tags:
+- medicine
+description:
+ zh: 多因素病理机制图 - 建模 '基因+环境+诱因 -> 疾病' 的复杂致病逻辑
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如基因、环境因素、诱因、疾病等
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:基因、环境因素、诱因、疾病、病理过程、症状等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: mechanism_name
+ type: string
+ description:
+ zh: 机制名称,简短描述性名称
+ - name: participating_entities
+ type: array
+ description:
+ zh: 参与此病理机制的所有实体名称列表
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:致病、诱发、促进、抑制等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述,如具体的致病机制
+ - name: outcome
+ type: string
+ description:
+ zh: 该机制导致的结果或效应
+guideline:
+ target:
+ zh: '你是一位专业的病理学家,请从文本中提取与疾病病理机制相关的实体和它们之间的复杂关联关系,构建多因素病理机制图。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ rules_for_entities:
+ zh:
+ - '- 医学专业术语保持原文,如基因名称(BRCA1、KRAS、TP53)、蛋白名称'
+ - '- 疾病名称保持原文,如慢性阻塞性肺疾病、肺癌'
+ rules_for_relations:
+ zh:
+ - '- 致病:导致疾病发生'
+ - '- 诱发:诱发疾病发作'
+ - '- 促进:促进疾病进展'
+ - '- 抑制:抑制疾病发展'
+identifiers:
+ entity_id: name
+ relation_id: mechanism_name
+ relation_members: participating_entities
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '[{relationType}] {mechanism_name}'
diff --git a/hyperextract/templates/legacy/presets/medicine/pharmacology_graph.yaml b/hyperextract/templates/legacy/presets/medicine/pharmacology_graph.yaml
new file mode 100644
index 0000000..a33a04e
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/pharmacology_graph.yaml
@@ -0,0 +1,78 @@
+language: zh
+name: PharmacologyGraph
+type: graph
+tags:
+- medicine
+description:
+ zh: 药理机制图 - 提取药物、受体、靶点及生理反应之间的相互作用路径
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如药物、受体、靶点、生理反应等
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:药物、受体、靶点、生理反应、信号通路等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体
+ - name: target
+ type: string
+ description:
+ zh: 目标实体
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:结合、激活、抑制、调节、诱导、拮抗等
+ - name: details
+ type: string
+ description:
+ zh: 详细描述,如具体的作用机制
+guideline:
+ target:
+ zh: '你是一位专业的药理学家,请从文本中提取药物、受体、靶点及生理反应之间的相互作用路径,构建药理机制图。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ rules_for_entities:
+ zh:
+ - '- 药物名称保持原文,如二甲双胍、阿司匹林'
+ - '- 受体名称保持原文,如胰岛素受体、肾上腺素受体'
+ - '- 信号通路名称保持原文,如AMPK通路、PI3K/Akt通路'
+ rules_for_relations:
+ zh:
+ - '- 结合:药物与受体结合'
+ - '- 激活:激活受体或通路'
+ - '- 抑制:抑制受体或通路'
+ - '- 调节:调节生理反应'
+ - '- 诱导:诱导特定反应'
+ - '- 拮抗:拮抗作用'
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/medicine/surgical_event_graph.yaml b/hyperextract/templates/legacy/presets/medicine/surgical_event_graph.yaml
new file mode 100644
index 0000000..0f83d68
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/surgical_event_graph.yaml
@@ -0,0 +1,78 @@
+language: zh
+name: SurgicalEventGraph
+type: hypergraph
+tags:
+- medicine
+description:
+ zh: 手术事件超图 - 将手术建模为连接 {医生, 部位, 术式, 器械} 共同参与的复杂事件
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如医生、部位、术式、器械等
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:医生、部位、术式、器械、麻醉方式等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 超边名称,如手术名称
+ - name: nodes
+ type: array
+ description:
+ zh: 参与超边的节点列表
+ - name: date
+ type: string
+ description:
+ zh: 手术日期
+ - name: duration
+ type: string
+ description:
+ zh: 手术时长
+ required: false
+ - name: details
+ type: string
+ description:
+ zh: 详细描述,如手术过程
+guideline:
+ target:
+ zh: '你是一位专业的外科医生,请从文本中提取手术事件及其相关实体,构建手术事件超图。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 超边连接2个或多个实体
+ rules_for_entities:
+ zh:
+ - '- 医生:手术主刀医生及参与人员'
+ - '- 部位:手术部位'
+ - '- 术式:具体手术方式'
+ - '- 器械:使用的医疗器械'
+ rules_for_relations:
+ zh:
+ - '- 一个超边代表一个完整的手术事件'
+ - '- 需要包含手术的时间、地点、参与人员等信息'
+identifiers:
+ entity_id: name
+ relation_id: name
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{name} ({date})'
diff --git a/hyperextract/templates/legacy/presets/medicine/treatment_regimen_map.yaml b/hyperextract/templates/legacy/presets/medicine/treatment_regimen_map.yaml
new file mode 100644
index 0000000..505ed3a
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/treatment_regimen_map.yaml
@@ -0,0 +1,71 @@
+language: zh
+name: TreatmentRegimenMap
+type: hypergraph
+tags:
+- medicine
+description:
+ zh: 综合治疗方案图 - 提取由 药物组合+理疗+生活干预 构成的多因素治疗方案
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如药物、理疗方法、生活干预等
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:药物、理疗、生活干预、检查、手术等
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ relations:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 超边名称,如治疗方案、康复计划等
+ - name: nodes
+ type: array
+ description:
+ zh: 参与超边的节点列表
+ - name: disease
+ type: string
+ description:
+ zh: 针对的疾病
+ - name: details
+ type: string
+ description:
+ zh: 详细描述,如具体的治疗方案内容
+guideline:
+ target:
+ zh: '你是一位专业的临床医生,请从文本中提取由"药物组合+理疗+生活干预"构成的多因素治疗方案,构建综合治疗方案图。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 超边必须包含多个节点
+ rules_for_entities:
+ zh:
+ - '- 药物名称保持原文,如二甲双胍、阿司匹林'
+ - '- 治疗方式保持原文,如放疗、化疗、手术'
+ rules_for_relations:
+ zh:
+ - '- 一个超边代表一个完整的治疗方案'
+ - '- 需要包含针对的疾病信息'
+identifiers:
+ entity_id: name
+ relation_id: name
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{name} - {disease}'
diff --git a/hyperextract/templates/legacy/presets/medicine/tumor_staging_item.yaml b/hyperextract/templates/legacy/presets/medicine/tumor_staging_item.yaml
new file mode 100644
index 0000000..7df62e4
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/medicine/tumor_staging_item.yaml
@@ -0,0 +1,57 @@
+language: zh
+name: TumorStagingItem
+type: model
+tags:
+- medicine
+description:
+ zh: TNM分期表 - 提取肿瘤大小(T)、淋巴结(N)、转移(M)及分期结果
+output:
+ description: {}
+ fields:
+ - name: tStage
+ type: string
+ description:
+ zh: T分期,如T1、T2、T3、T4等
+ - name: nStage
+ type: string
+ description:
+ zh: N分期,如N0、N1、N2、N3等
+ - name: mStage
+ type: string
+ description:
+ zh: M分期,如M0、M1等
+ - name: pathologicalStage
+ type: string
+ description:
+ zh: 病理分期,如I期、II期、III期、IV期等
+ - name: tDetails
+ type: string
+ description:
+ zh: T分期详细描述,如肿瘤大小
+ - name: nDetails
+ type: string
+ description:
+ zh: N分期详细描述,如淋巴结转移数量
+ - name: mDetails
+ type: string
+ description:
+ zh: M分期详细描述,如远处转移部位
+guideline:
+ target:
+ zh: '你是一位专业的病理学家,请从文本中提取肿瘤大小(T)、淋巴结(N)、转移(M)及分期结果,构建TNM分期表。
+
+ '
+ rules:
+ zh:
+ - 提取T分期、N分期、M分期和病理分期
+ - 为每个分期添加详细描述:
+ - '- T分期详细描述:肿瘤大小、浸润深度等'
+ - '- N分期详细描述:淋巴结转移数量、部位等'
+ - '- M分期详细描述:远处转移部位等'
+ - 保持信息与原文一致
+ rules_for_entities:
+ zh:
+ - '- TNM分期表示法保持原文,如 T1、T2、N0、M0'
+ - '- 分期表示法保持原文,如 I期、II期、III期、IV期'
+display:
+ label: 'TNM分期: {tStage}{nStage}{mStage} ({pathologicalStage})'
diff --git a/hyperextract/templates/legacy/presets/tcm/acupoint_location_map.yaml b/hyperextract/templates/legacy/presets/tcm/acupoint_location_map.yaml
new file mode 100644
index 0000000..86b0a52
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/acupoint_location_map.yaml
@@ -0,0 +1,97 @@
+language: zh
+name: AcupointLocationMap
+type: graph
+tags:
+- tcm
+description:
+ zh: 腧穴空间定位 - 基于人体解剖标志提取穴位的相对位置关系(如 '脐旁2寸')
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 穴位名称:如合谷、足三里、三阴交等
+ required: true
+ default: ''
+ - name: meridian
+ type: string
+ description:
+ zh: 所属经脉
+ required: false
+ default: ''
+ - name: location
+ type: string
+ description:
+ zh: 位置描述:如脐旁2寸、腕横纹上3寸等
+ required: false
+ default: ''
+ - name: indications
+ type: string
+ description:
+ zh: 主治功能
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源穴位或解剖标志名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标穴位名称
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:位于
+ required: true
+ default: ''
+ - name: relativePosition
+ type: string
+ description:
+ zh: 相对位置描述:如脐旁2寸、腕横纹上3寸等
+ required: true
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的针灸学专家,请从文本中提取穴位的相对位置关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 穴位:针灸特定位置,如合谷、足三里、三阴交
+ - 解剖标志:人体解剖部位,如腕横纹、第2掌骨
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 穴位:针灸特定位置
+ - 解剖标志:人体解剖部位
+ rules_for_relations:
+ zh:
+ - 仅从已知穴位列表中提取边,不要创建未列出的穴位
+ - 关系描述应与原文保持一致
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name}'
+ relation_label: '{relationType}: {relativePosition}'
diff --git a/hyperextract/templates/legacy/presets/tcm/compatibility_net.yaml b/hyperextract/templates/legacy/presets/tcm/compatibility_net.yaml
new file mode 100644
index 0000000..b15dd10
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/compatibility_net.yaml
@@ -0,0 +1,83 @@
+language: zh
+name: CompatibilityNet
+type: graph
+tags:
+- tcm
+description:
+ zh: 七情配伍网络 - 提取药物间的相须、相使、相畏、相杀、十八反十九畏关系
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 药物名称
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源药物
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标药物
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 配伍关系类型:相须、相使、相畏、相杀、相恶、相反、十八反、十九畏
+ required: true
+ default: ''
+ - name: effect
+ type: string
+ description:
+ zh: 配伍效果描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的中药配伍专家,请从文本中提取药物间的配伍关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 配伍关系类型:相须、相使、相畏、相杀、相恶、相反、十八反、十九畏
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ rules_for_relations:
+ zh:
+ - 仅从已知药物列表中提取边,不要创建未列出的药物
+ - 关系描述应与原文保持一致
+ - 配伍关系类型:相须、相使、相畏、相杀、相恶、相反、十八反、十九畏
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name}'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/tcm/formula_composition.yaml b/hyperextract/templates/legacy/presets/tcm/formula_composition.yaml
new file mode 100644
index 0000000..dde0d66
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/formula_composition.yaml
@@ -0,0 +1,127 @@
+language: zh
+name: FormulaComposition
+type: hypergraph
+tags:
+- tcm
+description:
+ zh: 君臣佐使结构图 - 将方剂建模为 {君药, 臣药, 佐药, 使药} 的层级化超边结构
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 药物名称
+ required: true
+ default: ''
+ - name: nature
+ type: string
+ description:
+ zh: 性味,如:辛温、苦寒、甘平
+ required: false
+ default: ''
+ - name: meridian
+ type: string
+ description:
+ zh: 归经,如:归肺经、归脾经、归心经
+ required: false
+ default: ''
+ - name: effect
+ type: string
+ description:
+ zh: 功效,如:发汗解表、温通经脉、补气健脾
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: formulaName
+ type: string
+ description:
+ zh: 方剂名称
+ required: true
+ default: ''
+ - name: source
+ type: string
+ description:
+ zh: 方剂来源,如:伤寒论、金匮要略、方剂学教材
+ required: false
+ default: ''
+ - name: junHerbs
+ type: array
+ description:
+ zh: 君药列表(包含药物名称、剂量、炮制方法)
+ required: false
+ default: ''
+ - name: chenHerbs
+ type: array
+ description:
+ zh: 臣药列表(包含药物名称、剂量、炮制方法)
+ required: false
+ default: ''
+ - name: zuoHerbs
+ type: array
+ description:
+ zh: 佐药列表(包含药物名称、剂量、炮制方法)
+ required: false
+ default: ''
+ - name: shiHerbs
+ type: array
+ description:
+ zh: 使药列表(包含药物名称、剂量、炮制方法)
+ required: false
+ default: ''
+ - name: functions
+ type: array
+ description:
+ zh: 方剂功能,如:解肌发表、调和营卫
+ required: false
+ default: ''
+ - name: indications
+ type: array
+ description:
+ zh: 主治证候,如:外感风寒表虚证
+ required: false
+ default: ''
+ - name: decoctionMethod
+ type: string
+ description:
+ zh: 煎服法,如:水煎服,日三服
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的方剂学专家,请从文本中提取方剂的君臣佐使结构。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 药物固有属性:性味、归经、功效(不随方剂变化)
+ - 药物在方剂中的属性:剂量、炮制方法、角色(君/臣/佐/使)
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 药物固有属性:性味、归经、功效
+ rules_for_relations:
+ zh:
+ - 仅从已知药物列表中提取边,不要创建未列出的药物
+ - 关系描述应与原文保持一致
+ - 药物角色:君药、臣药、佐药、使药
+identifiers:
+ entity_id: name
+ relation_id: formulaName
+ relation_members:
+ - junHerbs
+ - chenHerbs
+ - zuoHerbs
+ - shiHerbs
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name}'
+ relation_label: '{formulaName}'
diff --git a/hyperextract/templates/legacy/presets/tcm/function_indication_map.yaml b/hyperextract/templates/legacy/presets/tcm/function_indication_map.yaml
new file mode 100644
index 0000000..9c46ae3
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/function_indication_map.yaml
@@ -0,0 +1,94 @@
+language: zh
+name: FunctionIndicationMap
+type: graph
+tags:
+- tcm
+description:
+ zh: 主治功效映射 - 关联 方剂 -> 功能(如清热解毒) -> 主治证候
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:方剂、功能、主治证候
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源实体
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标实体
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:具有功能、主治
+ required: true
+ default: ''
+ - name: details
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的方剂学专家,请从文本中提取方剂、功能和主治证候之间的关联关系。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 方剂:如桂枝汤、麻黄汤
+ - 功能:如解肌发表、清热解毒
+ - 主治证候:如太阳中风、外感风寒
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 方剂:如桂枝汤、麻黄汤
+ - 功能:如解肌发表、清热解毒
+ - 主治证候:如太阳中风、外感风寒
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 关系类型:具有功能、主治
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
diff --git a/hyperextract/templates/legacy/presets/tcm/herb_property_model.yaml b/hyperextract/templates/legacy/presets/tcm/herb_property_model.yaml
new file mode 100644
index 0000000..7d91f59
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/herb_property_model.yaml
@@ -0,0 +1,96 @@
+language: zh
+name: HerbPropertyModel
+type: model
+tags:
+- tcm
+description:
+ zh: 药物性味归经 - 提取单味药的四气五味、归经、毒性及推荐剂量
+output:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 药物正名
+ required: true
+ default: ''
+ - name: alternativeNames
+ type: array
+ description:
+ zh: 别名、俗称
+ required: false
+ default: ''
+ - name: properties
+ type: array
+ description:
+ zh: 四气:寒、热、温、凉、平
+ required: false
+ default: ''
+ - name: flavors
+ type: array
+ description:
+ zh: 五味:酸、苦、甘、辛、咸
+ required: false
+ default: ''
+ - name: meridians
+ type: array
+ description:
+ zh: 归经:如肺经、肝经、脾经等
+ required: false
+ default: ''
+ - name: toxicity
+ type: string
+ description:
+ zh: 毒性:无毒、小毒、有毒、大毒
+ required: false
+ default: 无毒
+ - name: dosage
+ type: string
+ description:
+ zh: 推荐剂量
+ required: false
+ default: ''
+ - name: collection
+ type: string
+ description:
+ zh: 采集时间和方法
+ required: false
+ default: ''
+ - name: processing
+ type: string
+ description:
+ zh: 炮制方法
+ required: false
+ default: ''
+ - name: indications
+ type: array
+ description:
+ zh: 功效主治
+ required: false
+ default: ''
+ - name: contraindications
+ type: array
+ description:
+ zh: 配伍禁忌
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的中药学家,请从文本中提取单味药的性味归经、毒性及推荐剂量等信息。
+
+ '
+ rules:
+ zh:
+ - 识别文本的核心药物主体
+ - 提取药物的正名和所有别名、俗称
+ - 提取药物的四气(寒、热、温、凉、平)
+ - 提取药物的五味(酸、苦、甘、辛、咸)
+ - 提取药物的归经(如肺经、肝经、脾经等)
+ - 提取药物的毒性(无毒、小毒、有毒、大毒)
+ - 提取药物的推荐剂量
+ - 句式解析:文言文常采用省略主语、并列结构、连动句式,需先理解句式结构再提取信息
+ - 术语对应:文言术语与现代术语需正确对应(如"主"指"主治","疗"指"治疗")
+ - 连写拆分:文言中常连写多个属性(如"味甘微寒"→拆分为"味甘"、"微寒"),需分别归到对应字段
+ - 古代剂量:文言中古代剂量单位(如两、钱、匕)可保留原文
+display:
+ label: '{name} ({properties},{flavors})'
diff --git a/hyperextract/templates/legacy/presets/tcm/meridian_flow_graph.yaml b/hyperextract/templates/legacy/presets/tcm/meridian_flow_graph.yaml
new file mode 100644
index 0000000..8dc91a6
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/meridian_flow_graph.yaml
@@ -0,0 +1,104 @@
+language: zh
+name: MeridianFlowGraph
+type: graph
+tags:
+- tcm
+description:
+ zh: 经络流注图 - 提取十二经脉的循行路线及经气流注次序
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 经脉名称:如手太阴肺经、手阳明大肠经等
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 经脉类别:阴经、阳经
+ required: true
+ default: ''
+ - name: associatedOrgan
+ type: string
+ description:
+ zh: 关联脏腑
+ required: false
+ default: ''
+ - name: circulationPath
+ type: string
+ description:
+ zh: 循行路线
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: source
+ type: string
+ description:
+ zh: 源经脉名称
+ required: true
+ default: ''
+ - name: target
+ type: string
+ description:
+ zh: 目标经脉名称
+ required: true
+ default: ''
+ - name: relationType
+ type: string
+ description:
+ zh: 关系类型:流注
+ required: true
+ default: ''
+ - name: flowOrder
+ type: int
+ description:
+ zh: 流注次序
+ required: true
+ default: '0'
+ - name: connectionPoint
+ type: string
+ description:
+ zh: 连接部位
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的经络学专家,请从文本中提取十二经脉的循行路线及经气流注次序。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 经脉:十二经脉,如手太阴肺经、手阳明大肠经
+ - 经脉类别:阴经、阳经
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 经脉:十二经脉
+ - 经脉类别:阴经、阳经
+ rules_for_relations:
+ zh:
+ - 仅从已知经脉列表中提取边,不要创建未列出的经脉
+ - 关系描述应与原文保持一致
+ - 关系类型:流注
+identifiers:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: source
+ target: target
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '流注 #{flowOrder}'
diff --git a/hyperextract/templates/legacy/presets/tcm/prescription_modification.yaml b/hyperextract/templates/legacy/presets/tcm/prescription_modification.yaml
new file mode 100644
index 0000000..e3993c7
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/prescription_modification.yaml
@@ -0,0 +1,100 @@
+language: zh
+name: PrescriptionModification
+type: hypergraph
+tags:
+- tcm
+description:
+ zh: 处方加减逻辑 - 提取基于特定证型或症状对基础方剂进行的药物加减(如'随证加减')
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:基础方、药物、证型、症状
+ required: true
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: baseFormula
+ type: string
+ description:
+ zh: 基础方剂名称
+ required: true
+ default: ''
+ - name: condition
+ type: string
+ description:
+ zh: 加减条件(证型或症状)
+ required: true
+ default: ''
+ - name: modificationType
+ type: string
+ description:
+ zh: 加减类型:加、减、替换
+ required: true
+ default: ''
+ - name: herbs
+ type: array
+ description:
+ zh: 加减药物列表
+ required: true
+ default: ''
+ - name: reason
+ type: string
+ description:
+ zh: 加减原因
+ required: false
+ default: ''
+ - name: dosage
+ type: string
+ description:
+ zh: 调整后的剂量
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的中医方剂专家,请从文本中提取处方加减的实体和超边结构。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 基础方:方剂名称,如桂枝汤、麻黄汤、小柴胡汤
+ - 药物:中药名称,如葛根、厚朴、杏仁、附子
+ - 证型/症状:临床表现,如项背强几几、喘、腹满痛
+ - 加减类型:加、减、替换
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 基础方:方剂名称,如桂枝汤、麻黄汤、小柴胡汤
+ - 药物:中药名称,如葛根、厚朴、杏仁、附子
+ - 证型/症状:临床表现,如项背强几几、喘、腹满痛
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 加减类型:加、减、替换(通过 modificationType 字段区分)
+identifiers:
+ entity_id: name
+ relation_id: '{baseFormula}|{condition}'
+ relation_members:
+ - baseFormula
+ - herbs
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{baseFormula} | {condition}'
diff --git a/hyperextract/templates/legacy/presets/tcm/processing_method.yaml b/hyperextract/templates/legacy/presets/tcm/processing_method.yaml
new file mode 100644
index 0000000..79bb20e
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/processing_method.yaml
@@ -0,0 +1,56 @@
+language: zh
+name: ProcessingMethod
+type: list
+tags:
+- tcm
+description:
+ zh: 炮制方法列表 - 提取药物的不同炮制方法(如蜜炙、酒炒)及其对药效的影响
+output:
+ description: {}
+ fields:
+ - name: herbName
+ type: string
+ description:
+ zh: 药物名称
+ required: true
+ default: ''
+ - name: methodName
+ type: string
+ description:
+ zh: 炮制方法名称:如蜜炙、酒炒、醋制、盐制等
+ required: true
+ default: ''
+ - name: process
+ type: string
+ description:
+ zh: 具体炮制工艺流程
+ required: true
+ default: ''
+ - name: effectChange
+ type: string
+ description:
+ zh: 炮制对药效的影响
+ required: true
+ default: ''
+ - name: application
+ type: string
+ description:
+ zh: 适用病症或方剂
+ required: true
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的中药炮制专家,请从文本中提取药物的不同炮制方法及其对药效的影响。
+
+ '
+ rules:
+ zh:
+ - 识别文本中提到的所有药物及其炮制方法
+ - 提取每种炮制方法的名称
+ - 提取每种炮制方法的具体工艺流程
+ - 提取炮制对药效的影响
+ - 常用炮制方法:蜜炙、酒炒、醋制、盐制、炒、煅等
+ - 每种炮制方法作为独立条目提取
+ - 保持炮制方法描述与原文一致
+display:
+ label: '{herbName} - {methodName}'
diff --git a/hyperextract/templates/legacy/presets/tcm/pulse_tongue_record.yaml b/hyperextract/templates/legacy/presets/tcm/pulse_tongue_record.yaml
new file mode 100644
index 0000000..7d5effb
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/pulse_tongue_record.yaml
@@ -0,0 +1,62 @@
+language: zh
+name: PulseTongueRecord
+type: list
+tags:
+- tcm
+description:
+ zh: 舌脉特征提取 - 结构化提取舌象(质、苔)与脉象描述,用于统计分析
+output:
+ description: {}
+ fields:
+ - name: type
+ type: string
+ description:
+ zh: 特征类型:舌象、脉象
+ required: true
+ default: ''
+ - name: subType
+ type: string
+ description:
+ zh: 子类型:如舌质、舌苔、脉位、脉率、脉势等
+ required: true
+ default: ''
+ - name: feature
+ type: string
+ description:
+ zh: 具体特征描述,如淡红、薄白、浮、沉、迟、数等
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 详细描述
+ required: false
+ default: ''
+ - name: clinicalSignificance
+ type: string
+ description:
+ zh: 临床意义
+ required: false
+ default: ''
+ - name: source
+ type: string
+ description:
+ zh: 来源,如医案名称、章节等
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的中医诊断专家,请从文本中提取舌象和脉象的特征信息。
+
+ '
+ rules:
+ zh:
+ - 提取所有舌象特征,包括舌质(颜色、形态)、舌苔(颜色、厚薄、干湿等)
+ - 提取所有脉象特征,包括脉位(浮、沉)、脉率(迟、数)、脉势(有力、无力)等
+ - 为每个特征指定类型和子类型
+ - 保持特征描述与原文一致
+ - 舌象描述解析:文言舌象常采用连写表述(如"舌淡红苔薄白"→拆分为舌质淡红、舌苔薄白)
+ - 脉象术语理解:文言脉象术语需准确识别(如"浮紧脉"→浮脉、紧脉)
+ - 复合特征拆分:文言中常将多个特征合并描述,需分别提取到对应字段
+display:
+ label: '{type} - {subType}'
diff --git a/hyperextract/templates/legacy/presets/tcm/syndrome_reasoning_graph.yaml b/hyperextract/templates/legacy/presets/tcm/syndrome_reasoning_graph.yaml
new file mode 100644
index 0000000..a5b2121
--- /dev/null
+++ b/hyperextract/templates/legacy/presets/tcm/syndrome_reasoning_graph.yaml
@@ -0,0 +1,96 @@
+language: zh
+name: SyndromeReasoningGraph
+type: hypergraph
+tags:
+- tcm
+description:
+ zh: 辨证论治逻辑图 - 建模 {症状群} -> 证型 -> 治则 -> {处方} 的完整推理链条
+output:
+ description: {}
+ entities:
+ description: {}
+ fields:
+ - name: name
+ type: string
+ description:
+ zh: 实体名称,如症状、证型、治则、药物等
+ required: true
+ default: ''
+ - name: category
+ type: string
+ description:
+ zh: 实体类型:症状、证型、治则、药物
+ required: true
+ default: ''
+ - name: description
+ type: string
+ description:
+ zh: 简要描述
+ required: false
+ default: ''
+ relations:
+ description: {}
+ fields:
+ - name: nodes
+ type: array
+ description:
+ zh: 参与推理的节点列表:[症状1, 症状2, ..., 证型, 治则, 药物1, 药物2, ...]
+ required: true
+ default: ''
+ - name: reasoningType
+ type: string
+ description:
+ zh: 推理类型:辨证论治、随证加减
+ required: true
+ default: ''
+ - name: reasoningProcess
+ type: string
+ description:
+ zh: 推理过程描述
+ required: false
+ default: ''
+ - name: source
+ type: string
+ description:
+ zh: 推理来源,如医案名称、章节等
+ required: false
+ default: ''
+guideline:
+ target:
+ zh: '你是一位专业的中医辨证论治专家,请从文本中提取中医实体和辨证论治推理逻辑作为超边。
+
+ '
+ rules:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 症状:临床表现,如发热、汗出、恶风
+ - 证型:疾病分类,如太阳中风、太阳伤寒
+ - 治则:治疗原则,如解肌发表、调和营卫
+ - 药物:中药名称,如桂枝、麻黄、杏仁
+ - 推理类型:辨证论治、随证加减
+ - 推理链条:症状群 → 证型 → 治则 → 处方
+ rules_for_entities:
+ zh:
+ - 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
+ - 实体名称与原文保持一致
+ - 症状:临床表现,如发热、汗出、恶风
+ - 证型:疾病分类,如太阳中风、太阳伤寒
+ - 治则:治疗原则,如解肌发表、调和营卫
+ - 药物:中药名称,如桂枝、麻黄、杏仁
+ rules_for_relations:
+ zh:
+ - 仅从已知实体列表中提取边,不要创建未列出的实体
+ - 关系描述应与原文保持一致
+ - 推理类型:辨证论治、随证加减
+ - 推理链条:症状群 → 证型 → 治则 → 处方
+identifiers:
+ entity_id: name
+ relation_id: '{reasoningType}|{nodes}'
+ relation_members: nodes
+options:
+ extraction_mode: two_stage
+display:
+ entity_label: '{name} ({category})'
+ relation_label: '{reasoningType}'
diff --git a/hyperextract/templates/presets/finance/call_sentiment_hypergraph.yaml b/hyperextract/templates/presets/finance/call_sentiment_hypergraph.yaml
deleted file mode 100644
index 7210a15..0000000
--- a/hyperextract/templates/presets/finance/call_sentiment_hypergraph.yaml
+++ /dev/null
@@ -1,109 +0,0 @@
-name: "CallSentimentHypergraph"
-autotype: hypergraph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "电话会议情绪超图 - 从财报电话会议中提取多维情绪聚类"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "主题元素名称(例如'收入增长'、'CEO 蒂姆·库克'、'AI 投资周期'、'谨慎')"
- required: true
- default: ""
- - name: element_type
- type: "string"
- description:
- zh: "类型:主题、发言人、情绪、驱动因素"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "该元素的上下文或说明"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: cluster_name
- type: "string"
- description:
- zh: "描述性名称(例如'CEO 看好 AI 收入'、'CFO 对利润率持谨慎态度')"
- required: true
- default: ""
- - name: participating_elements
- type: "array"
- description:
- zh: "此情绪聚类中所有元素的名称(主题 + 发言人 + 情绪 + 驱动因素)"
- required: true
- default: ""
- - name: sentiment_polarity
- type: "string"
- description:
- zh: "整体情绪方向:看多、看空、中性、混合"
- required: true
- default: ""
- - name: intensity
- type: "string"
- description:
- zh: "情绪强度:强、中等、轻微"
- required: true
- default: ""
- - name: evidence
- type: "string"
- description:
- zh: "支持情绪判断的关键引述或意译"
- required: false
- default: ""
- - name: shift_from_prior
- type: "string"
- description:
- zh: "与前一季度基调的变化(如显著,例如'比第二季度更为谨慎'、'从中性上调')"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的财报电话会议情绪分析师,请从文本中提取主题、发言人、情绪信号及其多维关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别讨论的关键主题(收入、利润率、指引、战略)
- 4. 识别发言人及其角色
- 5. 评估每个主题-发言人组合的情绪方向和强度
- 6. 超边连接 主题 + 发言人 + 情绪 + 驱动因素
- 7. 记录与前一季度基调的变化
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别讨论的财务主题
- 4. 识别发言人(分析师、管理层)
- 5. 识别情绪标签和驱动因素
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 每个聚类连接 主题 + 发言人 + 情绪 + 驱动因素
- 4. 评估整体情绪方向和强度
- 5. 捕捉支撑证据
- 6. 记录与前几个季度的基调变化
-
-identifiers:
- node_id: "name"
- edge_id: "{cluster_name}|{participating_elements}"
- edge_members: "participating_elements"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} [{element_type}]"
- edge_label: "{cluster_name}"
diff --git a/hyperextract/templates/presets/finance/company_history_timeline.yaml b/hyperextract/templates/presets/finance/company_history_timeline.yaml
deleted file mode 100644
index aea5549..0000000
--- a/hyperextract/templates/presets/finance/company_history_timeline.yaml
+++ /dev/null
@@ -1,120 +0,0 @@
-name: "CompanyHistoryTimeline"
-autotype: temporal_graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "公司历史时间线 - 从招股说明书或公司历史文档中提取里程碑事件"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称"
- required: true
- default: ""
- - name: type
- type: "string"
- description:
- zh: "实体类型:公司、创始人、投资机构等"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "事件主体/相关实体"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "事件对象/相关实体"
- required: true
- default: ""
- - name: eventType
- type: "string"
- description:
- zh: "事件类型:成立、融资、并购、IPO、裁员、发布产品、管理层变更、股权变更、获得专利、获奖"
- required: true
- default: ""
- - name: eventDate
- type: "string"
- description:
- zh: "事件日期,格式为年-月-日或年份"
- required: false
- default: ""
- - name: details
- type: "string"
- description:
- zh: "事件详细描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的公司历史分析师,请从文本中提取公司相关的实体以及里程碑事件。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建新的实体
- 4. 关系描述应与原文保持一致
- 5. 仅提取与公司历史直接相关的核心实体
- 6. 重点关注:本公司、子公司、创始人、投资机构
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅提取与公司历史直接相关的核心实体
- 4. 重点关注:本公司、子公司、创始人、投资机构
- 5. 实体类型:公司、创始人、投资机构
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取事件,不要创建未列出的实体
- 2. 时间信息为可选,仅在文本中明确提及时才提取
- 3. source 和 target 只能是单个实体,不能是多个实体的拼接
- 4. 如果多个主体参与同一事件,应为每个主体创建独立的边
- 5. 事件类型:成立、融资、并购、IPO、裁员、发布产品、管理层变更、股权变更、获得专利、获奖
- rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期):
- - "去年" → {observation_time} 前一年
- - "今年" → {observation_time} 所属年份
- - "明年" → {observation_time} 后一年
- - "五年前" → {observation_time} 前五年
- - "最近" → {observation_time} 前1年
-
- 2. 明确日期:保持原格式
- - 年份(如 2015年)→ 2015
- - 年-月-日 → 保持原格式
-
- 3. 缺失时间:留空
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{eventType}|{details}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "eventDate"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({type})"
- edge_label: "{eventType} ({eventDate})"
diff --git a/hyperextract/templates/presets/finance/discussion_graph.yaml b/hyperextract/templates/presets/finance/discussion_graph.yaml
deleted file mode 100644
index 975ec36..0000000
--- a/hyperextract/templates/presets/finance/discussion_graph.yaml
+++ /dev/null
@@ -1,95 +0,0 @@
-name: "DiscussionGraph"
-autotype: graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "财报会议讨论图谱 - 从财报电话会议中提取实体及关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称"
- required: true
- default: ""
- - name: type
- type: "string"
- description:
- zh: "实体类型:参会人员、公司、产品、指标、行业"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "实体描述/说明"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体"
- required: true
- default: ""
- - name: relation_type
- type: "string"
- description:
- zh: "关系类型"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的财报会议分析师,请从文本中提取讨论中出现的实体以及它们之间的关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体
- 2. 实体名称与原文保持一致
- 3. 参会人员是核心,必须提取
- 4. 实体类型:参会人员(分析师、管理层)、公司、产品、指标、行业等
- 5. 关系类型:参会人员之间(提问、回答、追问、澄清、反问等)、参会人员与其他实体(提问关于、回答关于、看好、看衰、担忧、质疑等)、其他实体之间(竞争、合作、增长、下降等)
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将其合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 参会人员:分析师、管理层(CEO、CFO等)
- 4. 公司、产品、指标、行业
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 参会人员之间:提问、回答、追问、澄清、反问等
- 4. 参会人员与其他实体:提问关于、回答关于、看好、看衰、担忧、质疑、主导、负责等
- 5. 其他实体之间:竞争、合作、增长、下降等
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relation_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({type})"
- edge_label: "{relation_type}"
diff --git a/hyperextract/templates/presets/finance/earnings_call_summary.yaml b/hyperextract/templates/presets/finance/earnings_call_summary.yaml
deleted file mode 100644
index f9970fb..0000000
--- a/hyperextract/templates/presets/finance/earnings_call_summary.yaml
+++ /dev/null
@@ -1,124 +0,0 @@
-name: "EarningsCallSummary"
-autotype: model
-tag: [finance]
-
-language: zh
-
-description:
- zh: "财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标、业绩指引和整体基调"
-
-schema:
- fields:
- - name: company_name
- type: "string"
- description:
- zh: "公司名称"
- required: false
- default: ""
- - name: ticker
- type: "string"
- description:
- zh: "股票代码"
- required: false
- default: ""
- - name: quarter
- type: "string"
- description:
- zh: "报告季度(例如'Q3 FY2024'、'2024 年第四季度')"
- required: false
- default: ""
- - name: call_date
- type: "string"
- description:
- zh: "财报电话会议日期"
- required: false
- default: ""
- - name: reported_revenue
- type: "string"
- description:
- zh: "本季度报告收入(例如'948 亿美元')"
- required: false
- default: ""
- - name: revenue_vs_consensus
- type: "string"
- description:
- zh: "收入与市场一致预期对比(例如'超出 12 亿美元'、'符合预期'、'低于预期 5 亿美元')"
- required: false
- default: ""
- - name: reported_eps
- type: "string"
- description:
- zh: "报告的稀释每股收益(例如'1.46 美元')"
- required: false
- default: ""
- - name: eps_vs_consensus
- type: "string"
- description:
- zh: "每股收益与一致预期对比(例如'超出 0.05 美元')"
- required: false
- default: ""
- - name: guidance_revenue
- type: "string"
- description:
- zh: "前瞻性收入指引(例如'第四季度 950-970 亿美元'、'2025 财年收入 3800-3900 亿美元')"
- required: false
- default: ""
- - name: guidance_eps
- type: "string"
- description:
- zh: "前瞻性每股收益指引(如有提供)"
- required: false
- default: ""
- - name: overall_tone
- type: "string"
- description:
- zh: "电话会议整体基调:'积极'、'审慎乐观'、'中性'、'谨慎'、'消极'"
- required: false
- default: ""
- - name: key_highlights
- type: "array"
- description:
- zh: "管理层准备发言中的 3-5 项核心亮点"
- required: false
- default: ""
- - name: key_concerns
- type: "array"
- description:
- zh: "管理层或分析师在问答环节提出的主要关切"
- required: false
- default: ""
- - name: strategic_priorities
- type: "array"
- description:
- zh: "管理层强调的战略重点"
- required: false
- default: ""
- - name: ceo_name
- type: "string"
- description:
- zh: "CEO 或主要发言人姓名"
- required: false
- default: ""
- - name: cfo_name
- type: "string"
- description:
- zh: "CFO 姓名"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的分析师,请从财报电话会议记录中提取关键财务指标、业绩指引和整体基调。
- rules:
- zh: |
- 1. 每个对象对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 提取确切的报告数据(收入、每股收益)并与一致预期进行对比
- 4. 捕捉收入和盈利的前瞻性指引
- 5. 评估电话会议的整体基调(管理层措辞、分析师反应)
- 6. 列出准备发言中的核心亮点和问答环节中的主要关切
- 7. 识别管理层强调的战略重点
-
-display:
- label: "{company_name} - {quarter}"
diff --git a/hyperextract/templates/presets/finance/factor_influence_hypergraph.yaml b/hyperextract/templates/presets/finance/factor_influence_hypergraph.yaml
deleted file mode 100644
index 30f78ff..0000000
--- a/hyperextract/templates/presets/finance/factor_influence_hypergraph.yaml
+++ /dev/null
@@ -1,87 +0,0 @@
-name: "FactorInfluenceHypergraph"
-autotype: hypergraph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "因子影响超图 - 建模股票分析中的多因子关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "因子名称"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "因子类别:宏观、行业、公司、市场情绪"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "因子描述/说明"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: result
- type: "string"
- description:
- zh: "结果/影响,如'业绩下滑'、'估值提升'、'价格上涨',不超过10字"
- required: true
- default: ""
- - name: factors
- type: "array"
- description:
- zh: "导致该结果的因子列表(至少2个)"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "详细描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的金融多因子分析师,请从文本中提取因子(作为节点)和因子导致的结果(作为超边)。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的因子,禁止将多个因子合并为一个节点
- 2. 因子名称与原文保持一致
- 3. 每条超边必须连接2个或以上因子
- 4. 优先提取包含3个及以上因子的超边
- 5. 因子类别:宏观(GDP增速、CPI、PPI、利率、汇率等)、行业(景气度、政策、供需格局等)、公司(营收、ROE、PE、净利润等)、市场情绪(资金流向、风险偏好等)
- 6. 结果类型:业绩类(业绩下滑、业绩增长、盈利提升等)、估值类(估值提升、估值承压、市值增长等)、价格类(价格上涨、股价下跌、成本上升等)、需求类(需求旺盛、需求疲软、订单增加等)
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的因子,禁止将多个因子合并为一个节点
- 2. 因子名称与原文保持一致
- 3. 因子类别:宏观(GDP、CPI、利率、汇率等)、行业(景气度、政策、供需等)、公司(营收、ROE、PE等)、市场情绪(资金流向、风险偏好等)
- rules_for_edges:
- zh: |
- 1. 仅从已知因子列表中提取超边,不要创建未列出的因子
- 2. 每条超边必须连接至少2个因子
- 3. 优先提取包含3个及以上因子的超边
- 4. 结果描述不超过10字
- 5. 结果类型:业绩类、估值类、价格类、需求类
-
-identifiers:
- node_id: "name"
- edge_id: "{result}_{factors}"
- edge_members: "factors"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{result}"
diff --git a/hyperextract/templates/presets/finance/filing_financial_snapshot.yaml b/hyperextract/templates/presets/finance/filing_financial_snapshot.yaml
deleted file mode 100644
index efce097..0000000
--- a/hyperextract/templates/presets/finance/filing_financial_snapshot.yaml
+++ /dev/null
@@ -1,107 +0,0 @@
-name: "FilingFinancialSnapshot"
-autotype: model
-tag: [finance]
-
-language: zh
-
-description:
- zh: "财报财务快照 - 从 SEC 申报文件中提取关键财务数据"
-
-schema:
- fields:
- - name: company_name
- type: "string"
- description:
- zh: "申报实体的法定名称"
- required: false
- default: ""
- - name: ticker
- type: "string"
- description:
- zh: "股票代码(例如 'AAPL'、'MSFT')"
- required: false
- default: ""
- - name: filing_type
- type: "string"
- description:
- zh: "申报类型:'10-K'、'10-Q'、'8-K'、'20-F'"
- required: false
- default: ""
- - name: filing_period
- type: "string"
- description:
- zh: "涵盖的财务期间(例如 'FY2024'、'Q3 2024')"
- required: false
- default: ""
- - name: revenue
- type: "string"
- description:
- zh: "总营收或净销售额(例如 '3943亿美元')"
- required: false
- default: ""
- - name: net_income
- type: "string"
- description:
- zh: "净利润"
- required: false
- default: ""
- - name: earnings_per_share
- type: "string"
- description:
- zh: "稀释每股收益(例如 '$6.13')"
- required: false
- default: ""
- - name: total_assets
- type: "string"
- description:
- zh: "总资产"
- required: false
- default: ""
- - name: total_liabilities
- type: "string"
- description:
- zh: "总负债"
- required: false
- default: ""
- - name: shareholders_equity
- type: "string"
- description:
- zh: "股东权益"
- required: false
- default: ""
- - name: operating_cash_flow
- type: "string"
- description:
- zh: "经营活动现金流"
- required: false
- default: ""
- - name: free_cash_flow
- type: "string"
- description:
- zh: "自由现金流"
- required: false
- default: ""
- - name: key_metrics
- type: "array"
- description:
- zh: "其他关键财务指标列表(如毛利率、ROE、市盈率等)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的财务分析师,请从 SEC 申报文件中提取关键财务数据。
- rules:
- zh: |
- 1. 每个对象对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 按报告原文提取精确的金额数据,保留单位(百万、十亿)
- 4. 识别申报实体、股票代码、申报类型和财务期间
- 5. 在可获取时同时提取最近期间和前期对比数据
- 6. 捕获申报文件中明确列出的关键财务比率
- 7. 使用表格中的精确数据;除非文件明确给出,否则不要计算衍生数值
-
-
-display:
- label: "{company_name} ({ticker}) - {filing_period}"
diff --git a/hyperextract/templates/presets/finance/filing_risk_factor_set.yaml b/hyperextract/templates/presets/finance/filing_risk_factor_set.yaml
deleted file mode 100644
index cc47a0a..0000000
--- a/hyperextract/templates/presets/finance/filing_risk_factor_set.yaml
+++ /dev/null
@@ -1,72 +0,0 @@
-name: "FilingRiskFactorSet"
-autotype: set
-tag: [finance]
-
-language: zh
-
-description:
- zh: "申报风险因素集 - 对 SEC 申报文件中的风险因素进行去重和归类"
-
-item_schema:
- fields:
- - name: risk_title
- type: "string"
- description:
- zh: "风险因素的简明标题(例如 '网络安全漏洞风险'、'外汇敞口')"
- required: true
- default: ""
- - name: risk_category
- type: "string"
- description:
- zh: "类别:'市场'、'运营'、'监管'、'财务'、'战略'、'网络安全'、'ESG'、'法律'、'地缘政治'"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "申报文件中披露的风险完整描述"
- required: true
- default: ""
- - name: potential_impact
- type: "string"
- description:
- zh: "所述的潜在财务或运营影响(例如 '对营收产生重大不利影响')"
- required: false
- default: ""
- - name: affected_areas
- type: "array"
- description:
- zh: "受影响的业务板块或职能(例如 ['国际业务', '供应链'])"
- required: false
- default: ""
- - name: mitigation_disclosed
- type: "string"
- description:
- zh: "公司已披露的任何缓解措施或管控手段"
- required: false
- default: ""
- - name: is_new
- type: "bool"
- description:
- zh: "与前期申报相比,该风险因素是否为新增"
- required: false
- default: false
-
-guide:
- target:
- zh: |
- 你是一位专业的监管申报分析师,请从 SEC 申报文件的风险因素章节中提取并归类所有单项风险因素。
- rules:
- zh: |
- 1. 每个元素对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 规范化:将相关的风险描述归纳到一个简明的风险标题下
- 4. 分类:将每项风险归入其主要类别
- 5. 完整性:提取每一个不同的风险因素,即使只是简要提及
- 6. 累积合并:如果同一风险在不同章节中出现了更多细节,则合并相关信息
-
-identifiers:
- item_id: "risk_title"
-
-display:
- label: "[{risk_category}] {risk_title}"
diff --git a/hyperextract/templates/presets/finance/financial_data_temporal_graph.yaml b/hyperextract/templates/presets/finance/financial_data_temporal_graph.yaml
deleted file mode 100644
index a57772f..0000000
--- a/hyperextract/templates/presets/finance/financial_data_temporal_graph.yaml
+++ /dev/null
@@ -1,121 +0,0 @@
-name: "FinancialDataTemporalGraph"
-autotype: temporal_graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "财务数据时序图谱 - 跨报告期追踪财务指标变化"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体的规范名称(例如 '苹果公司'、'云服务分部'、'营业收入'、'净利润')"
- required: true
- default: ""
- - name: entity_type
- type: "string"
- description:
- zh: "类型:'公司'、'分部'、'财务指标'、'会计科目'、'外部因素'"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要背景说明(例如 '消费电子业务板块'、'GAAP 收入确认口径')"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "主体(公司/分部/指标名称)"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标(指标/分部/因素名称)"
- required: true
- default: ""
- - name: relationship
- type: "string"
- description:
- zh: "关系类型:'拥有'、'同比变化'、'占比'、'贡献'、'影响'"
- required: true
- default: ""
- - name: value
- type: "string"
- description:
- zh: "数值(如 '3943亿美元'、'+7.8%'、'30%')"
- required: false
- default: ""
- - name: fiscal_period
- type: "string"
- description:
- zh: "财务期间(如 'FY2024'、'Q3 2024')"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的财务分析师,请从文本中提取财务实体及其跨时间的量化关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 将公司、业务分部和财务指标/会计科目识别为实体
- 6. 对每个报告数据,创建连接报告主体与指标的边,附带精确数值和财务期间
- 7. 将同比变化、衍生比率和分部贡献分别作为独立的边提取
- 8. 保留源文本中的精确金额和单位
- 9. 统一使用一致的财务期间标签(例如 'FY2024'、'Q3 2024')
- rules_for_nodes:
- zh: |
- 1. 每个节点对应一个独立实体
- 2. 实体名称与原文保持一致
- 3. 提取的节点名称要完整准确,因为边会引用这些名称
- 4. 公司:申报公司及其重要子公司
- 5. 分部:业务分部或区域(具体名称)
- 6. 财务指标:关键财务指标(营业收入、净利润、毛利率等)
- 7. 会计科目:主要会计科目
- 8. 外部因素:影响财务的外部因素
- rules_for_edges:
- zh: |
- 1. source 和 target 都必须是已知实体列表中的节点
- 2. 每个出现的财务数据都必须提取为一条边
- 3. 节点名称必须完全匹配
- 4. 关系类型:拥有、同比变化、占比、贡献、影响
- rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期):
- - "去年" → {observation_time} 的前一年
- - "上月" → {observation_time} 的前一个月
- - "本季度" → {observation_time} 所在季度
- - "FY2024" → 2024财年
-
- 2. 精确时间 → 保持原样
- 3. 时间缺失 → 留空,不要猜测
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationship}|{target}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "fiscal_period"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({entity_type})"
- edge_label: "{relationship} ({value})"
diff --git a/hyperextract/templates/presets/finance/financial_forecast.yaml b/hyperextract/templates/presets/finance/financial_forecast.yaml
deleted file mode 100644
index b8e0629..0000000
--- a/hyperextract/templates/presets/finance/financial_forecast.yaml
+++ /dev/null
@@ -1,75 +0,0 @@
-name: "FinancialForecast"
-autotype: list
-tag: [finance]
-
-language: zh
-
-description:
- zh: "财务预测 - 从股票研究报告中提取预测财务数据"
-
-item_schema:
- fields:
- - name: metric
- type: "string"
- description:
- zh: "被预测的财务指标(例如 '收入'、'每股收益'、'EBITDA'、'营业利润率'、'自由现金流')"
- required: true
- default: ""
- - name: period
- type: "string"
- description:
- zh: "预测期间(例如 'FY2025E'、'Q1 2025E'、'CY2026E')"
- required: true
- default: ""
- - name: estimate
- type: "string"
- description:
- zh: "预测值(例如 '$120.5B'、'$6.25'、'35.2%')"
- required: true
- default: ""
- - name: prior_estimate
- type: "string"
- description:
- zh: "如有修订,之前的预测值(例如 '$115.0B')"
- required: false
- default: ""
- - name: consensus
- type: "string"
- description:
- zh: "用于对比的市场一致性预期(例如 '$118.2B')"
- required: false
- default: ""
- - name: growth_rate
- type: "string"
- description:
- zh: "隐含增长率(例如 '同比+15%'、'持平')"
- required: false
- default: ""
- - name: assumptions
- type: "string"
- description:
- zh: "预测所依据的关键假设(例如 '假设销量增加 500 万台')"
- required: false
- default: ""
- - name: source_firm
- type: "string"
- description:
- zh: "提供该预测的研究机构"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的金融分析师,请从文本中提取所有财务预测和估算。
- rules:
- zh: |
- 1. 每个条目对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 提取每个预测指标及其对应的具体时间段
- 4. 在注明修订时,同时捕获当前和之前的预测值
- 5. 在进行对比时提取一致性预期
- 6. 捕获增长率和关键假设
-
-display:
- label: "{metric} ({period}): {estimate}"
diff --git a/hyperextract/templates/presets/finance/management_guidance_list.yaml b/hyperextract/templates/presets/finance/management_guidance_list.yaml
deleted file mode 100644
index 401c6f2..0000000
--- a/hyperextract/templates/presets/finance/management_guidance_list.yaml
+++ /dev/null
@@ -1,76 +0,0 @@
-name: "ManagementGuidanceList"
-autotype: list
-tag: [finance]
-
-language: zh
-
-description:
- zh: "管理层业绩指引列表 - 从财报电话会议中提取管理层未来业绩指引"
-
-item_schema:
- fields:
- - name: guidance_topic
- type: "string"
- description:
- zh: "指引主题(例如'第四季度收入'、'2025 财年资本支出'、'毛利率展望'、'招聘计划')"
- required: true
- default: ""
- - name: guidance_type
- type: "string"
- description:
- zh: "类型:定量、定性、战略、运营"
- required: true
- default: ""
- - name: guidance_value
- type: "string"
- description:
- zh: "指引内容或预测值(例如'950-970 亿美元'、'将拓展 5 个新市场'、'预计下半年利润率改善')"
- required: true
- default: ""
- - name: prior_guidance
- type: "string"
- description:
- zh: "同一指标的前次指引(如有修订,例如'900-930 亿美元')"
- required: false
- default: ""
- - name: direction
- type: "string"
- description:
- zh: "相对前次指引或一致预期的方向:'上调'、'下调'、'维持'、'首次发布'"
- required: false
- default: ""
- - name: time_period
- type: "string"
- description:
- zh: "指引覆盖的时间段(例如'2024 年第四季度'、'2025 财年'、'未来 12 个月')"
- required: false
- default: ""
- - name: confidence_language
- type: "string"
- description:
- zh: "管理层的确信程度措辞(例如'我们预计'、'我们有信心'、'我们预期')"
- required: false
- default: ""
- - name: speaker
- type: "string"
- description:
- zh: "指引发布者(例如'CEO'、'CFO'、'COO')"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的分析师,请从财报电话会议记录中提取所有前瞻性声明和业绩指引。
- rules:
- zh: |
- 1. 每个条目对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 提取每一项指引条目(定量数据、战略规划、展望声明)
- 4. 注明指引相较前次是上调、下调还是维持不变
- 5. 捕捉每项指引覆盖的时间段
- 6. 保留管理层的确信程度措辞
- 7. 识别每项指引的发布者
-
-display:
- label: "{guidance_topic} [{direction}]: {guidance_value}"
diff --git a/hyperextract/templates/presets/finance/market_narrative_timeline.yaml b/hyperextract/templates/presets/finance/market_narrative_timeline.yaml
deleted file mode 100644
index 82c9352..0000000
--- a/hyperextract/templates/presets/finance/market_narrative_timeline.yaml
+++ /dev/null
@@ -1,115 +0,0 @@
-name: "MarketNarrativeTimeline"
-autotype: temporal_graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "市场叙事时间线 - 追踪市场叙事随时间的演变"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "叙事名称(如'通胀恐惧'、'软着陆希望')"
- required: true
- default: ""
- - name: narrative_type
- type: "string"
- description:
- zh: "叙事类型:'市场情绪'、'投资主题'、'政策预期'、'经济判断'"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "叙事描述"
- required: true
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "先前叙事名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "新兴叙事名称"
- required: true
- default: ""
- - name: transition_type
- type: "string"
- description:
- zh: "演变类型:被替代、演变为、触发了、主导了"
- required: true
- default: ""
- - name: timestamp
- type: "string"
- description:
- zh: "演变时间(如'2024-03'、'2024年Q2')"
- required: true
- default: ""
- - name: catalyst
- type: "string"
- description:
- zh: "触发演变的事件或数据点"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的策略师,请从财经评论中提取市场叙事以及它们随时间的演变。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的叙事,禁止将多个叙事合并为一个节点
- 2. 叙事名称与原文保持一致
- 3. 仅从已知叙事列表中提取边,不要创建新的叙事
- 4. 关系描述应与原文保持一致
- 5. 叙事是市场中的"故事"、主题、情绪
- 6. 叙事不是具体的公司、指数、政策本身
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的叙事,禁止将多个叙事合并为一个节点
- 2. 叙事名称与原文保持一致
- 3. 叙事是市场中的"故事"、主题、情绪
- 4. 叙事不是具体的公司、指数、政策本身
- 5. 叙事类型:市场情绪、投资主题、政策预期、经济判断
- rules_for_edges:
- zh: |
- 1. 边的 source 和 target 必须完全使用下方叙事列表中的名称,禁止创造新叙事
- 2. 仅从已知叙事列表中提取边,不要创建新的叙事
- 3. 关系描述应与原文保持一致
- 4. 演变类型:被替代、演变为、触发了、主导了
- rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期):
- - "去年" → {observation_time} 的前一年
- - "上月" → {observation_time} 的前一个月
- - "本季度" → {observation_time} 所在季度
- - "近期" → {observation_time} 最近 3 个月
-
- 2. 精确时间 → 保持原样
- 3. 时间缺失 → 留空
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{transition_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "timestamp"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({narrative_type})"
- edge_label: "{transition_type} [{timestamp}]"
diff --git a/hyperextract/templates/presets/finance/market_sentiment_model.yaml b/hyperextract/templates/presets/finance/market_sentiment_model.yaml
deleted file mode 100644
index 188e831..0000000
--- a/hyperextract/templates/presets/finance/market_sentiment_model.yaml
+++ /dev/null
@@ -1,94 +0,0 @@
-name: "MarketSentimentModel"
-autotype: model
-tag: [finance]
-
-language: zh
-
-description:
- zh: "市场情绪模型 - 从财经新闻中提取情绪极性、提及实体和预期价格影响"
-
-schema:
- fields:
- - name: headline
- type: "string"
- description:
- zh: "新闻文章/评论的标题/主题"
- required: true
- default: ""
- - name: source
- type: "string"
- description:
- zh: "出版物或来源(例如 '彭博社'、'路透社'、'CNBC')"
- required: false
- default: ""
- - name: publication_date
- type: "string"
- description:
- zh: "发布日期"
- required: false
- default: ""
- - name: overall_sentiment
- type: "string"
- description:
- zh: "整体情绪:看涨、看跌、中性、混合"
- required: false
- default: ""
- - name: sentiment_confidence
- type: "string"
- description:
- zh: "情绪评估的置信度:高、中、低"
- required: false
- default: ""
- - name: mentioned_tickers
- type: "array"
- description:
- zh: "提及的股票代码(例如 ['AAPL', 'MSFT', 'GOOGL'])"
- required: false
- default: ""
- - name: mentioned_sectors
- type: "array"
- description:
- zh: "涉及的行业板块(例如 ['科技', '金融', '能源'])"
- required: false
- default: ""
- - name: key_events
- type: "array"
- description:
- zh: "驱动情绪的关键事件(例如 ['美联储利率决议', 'NVDA 财报超预期'])"
- required: false
- default: ""
- - name: expected_impact
- type: "string"
- description:
- zh: "预期的价格/市场影响(例如 '科技股短期上行'、'板块轮动可能性大')"
- required: false
- default: ""
- - name: time_horizon
- type: "string"
- description:
- zh: "隐含时间范围:'盘中'、'短期'、'中期'、'长期'"
- required: false
- default: ""
- - name: contrarian_signals
- type: "array"
- description:
- zh: "任何逆向或不同意见的观点"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的金融情绪分析师,请从财经新闻文章或市场评论中提取情绪快照。
- rules:
- zh: |
- 1. 每个对象对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 判断整体情绪极性(看涨/看跌/中性/混合)
- 4. 识别所有提及的股票代码和行业板块
- 5. 提取驱动情绪的关键事件
- 6. 评估预期市场影响和时间范围
- 7. 记录任何逆向或不同意见的观点
-
-display:
- label: "{headline}"
diff --git a/hyperextract/templates/presets/finance/material_event_timeline.yaml b/hyperextract/templates/presets/finance/material_event_timeline.yaml
deleted file mode 100644
index e230aca..0000000
--- a/hyperextract/templates/presets/finance/material_event_timeline.yaml
+++ /dev/null
@@ -1,131 +0,0 @@
-name: "MaterialEventTimeline"
-autotype: temporal_graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "重大事件时间线 - 从 8-K 申报文件中按时间顺序提取重大事件"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(例如 公司名称、高管姓名、监管机构)"
- required: true
- default: ""
- - name: entity_type
- type: "string"
- description:
- zh: "类型:'公司'、'高管'、'监管机构'、'交易对手'、'子公司'、'审计师'"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "角色或背景(例如 '首席执行官'、'收购方'、'SEC')"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "行为实体名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "受影响实体名称"
- required: true
- default: ""
- - name: event_type
- type: "string"
- description:
- zh: "类型:'高管任命'、'高管离职'、'收购'、'资产剥离'、'财务重述'、'破产'、'退市'、'重大协议'、'股息宣派'、'股票拆分'、'监管行动'"
- required: true
- default: ""
- - name: start_timestamp
- type: "string"
- description:
- zh: "事件发生或公告的日期(例如 '2024-03-15'、'2024年3月15日')"
- required: false
- default: ""
- - name: end_timestamp
- type: "string"
- description:
- zh: "如适用的结束日期(例如 生效日期、交割日期)"
- required: false
- default: ""
- - name: description
- type: "string"
- description:
- zh: "重大事件的详细信息,包括财务条款、条件或监管背景"
- required: false
- default: ""
- - name: sec_item
- type: "string"
- description:
- zh: "8-K 条目编号(例如 'Item 5.02'、'Item 1.01'、'Item 2.01')"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的监管申报分析师,请从文本中提取参与重大事件的实体及其之间的时序关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别涉及的公司、高管、监管机构和交易对手
- 6. 提取每个重大事件及其具体日期
- 7. 在可获取时按 8-K 条目编号对事件进行分类
- 8. 捕获财务条款、条件和监管背景
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别公司、高管、监管机构、审计师和交易对手
- 4. 按类型对每个实体进行分类
- 5. 捕获角色描述
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 通过重大事件连接实体
- 4. 提取每个事件的具体日期
- 5. 按事件类型和 8-K 条目编号进行分类
- 6. 捕获财务条款和条件
- rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期):
- - "去年" → {observation_time} 的前一年
- - "上月" → {observation_time} 的前一个月
- - "本季度" → {observation_time} 所在季度
- - "近期" → {observation_time} 最近 3 个月
-
- 2. 精确时间 → 保持原样
- 3. 时间缺失 → 留空,不要猜测
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{event_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "start_timestamp"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({entity_type})"
- edge_label: "{event_type} [{start_timestamp}]"
diff --git a/hyperextract/templates/presets/finance/multi_source_sentiment_hypergraph.yaml b/hyperextract/templates/presets/finance/multi_source_sentiment_hypergraph.yaml
deleted file mode 100644
index 36bc2bd..0000000
--- a/hyperextract/templates/presets/finance/multi_source_sentiment_hypergraph.yaml
+++ /dev/null
@@ -1,121 +0,0 @@
-name: "MultiSourceSentimentHypergraph"
-autotype: hypergraph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "多源情绪超图 - 整合多个来源的情绪信号"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "来源或实体的名称(例如:'彭博社文章'、'高盛分析师报告'、'AAPL'、'科技板块')"
- required: true
- default: ""
- - name: source_type
- type: "string"
- description:
- zh: "类型:'新闻文章'、'分析师报告'、'社交媒体'、'市场数据'、'公司公告'、'受影响实体'、'板块'、'指数'"
- required: true
- default: ""
- - name: sentiment_signal
- type: "string"
- description:
- zh: "该来源的个别情绪:'看涨'、'看跌'、'中性'"
- required: false
- default: ""
- - name: credibility
- type: "string"
- description:
- zh: "来源可信度评估:'一级'、'二级'、'未验证'"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: fusion_name
- type: "string"
- description:
- zh: "描述性名称(例如:'AAPL 来自 3 个来源的看涨共识')"
- required: true
- default: ""
- - name: participating_sources
- type: "array"
- description:
- zh: "参与此融合的所有来源和受影响实体的名称"
- required: true
- default: ""
- - name: aggregated_polarity
- type: "string"
- description:
- zh: "融合情绪:'强烈看涨'、'看涨'、'中性'、'看跌'、'强烈看跌'、'冲突'"
- required: true
- default: ""
- - name: agreement_level
- type: "string"
- description:
- zh: "来源一致性:'一致'、'多数'、'分裂'、'矛盾'"
- required: true
- default: ""
- - name: affected_entity
- type: "string"
- description:
- zh: "情绪适用的主要实体(股票代码或板块)"
- required: false
- default: ""
- - name: signal_strength
- type: "string"
- description:
- zh: "交易用的整体信号强度:'可操作'、'参考性'、'噪音'"
- required: false
- default: ""
- - name: conflicting_views
- type: "string"
- description:
- zh: "任何不同或冲突的情绪信号摘要"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的多源情绪融合分析师,请从不同来源提取情绪信号并创建聚合情绪视图。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别每个不同的情绪来源(新闻、分析师报告、社交媒体)
- 4. 提取每个来源的个别情绪信号
- 5. 创建连接来源到受影响实体的聚合情绪超边
- 6. 评估各来源之间的一致性
- 7. 记录冲突观点和信号强度
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别新闻文章、分析师报告和社交媒体帖子
- 4. 识别受影响实体(股票代码、板块、指数)
- 5. 捕捉每个来源的个别情绪
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 每条超边连接多个来源到一个受影响实体
- 4. 评估聚合情绪极性和一致性水平
- 5. 评估交易用途的信号强度
- 6. 记录任何冲突观点
-
-identifiers:
- node_id: "name"
- edge_id: "fusion_name"
- edge_members: "participating_sources"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({source_type})"
- edge_label: "{fusion_name}"
diff --git a/hyperextract/templates/presets/finance/proceeds_usage.yaml b/hyperextract/templates/presets/finance/proceeds_usage.yaml
deleted file mode 100644
index 0b9d6fa..0000000
--- a/hyperextract/templates/presets/finance/proceeds_usage.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-name: "ProceedsUsage"
-autotype: list
-tag: [finance]
-
-language: zh
-
-description:
- zh: "募集资金用途列表 - 从 IPO 招股说明书中提取募集资金分配计划"
-
-item_schema:
- fields:
- - name: use_category
- type: "string"
- description:
- zh: "资金用途类别(例如'研发投入'、'偿还债务'、'营运资金'、'收购'、'资本支出'、'一般企业用途')"
- required: true
- default: ""
- - name: project_name
- type: "string"
- description:
- zh: "具体项目或计划名称(例如'弗吉尼亚新数据中心'、'平台 2.0 开发')"
- required: false
- default: ""
- - name: allocated_amount
- type: "string"
- description:
- zh: "分配金额(例如'1.5 亿美元'、'约占净募集资金的 30%')"
- required: false
- default: ""
- - name: percentage_of_proceeds
- type: "string"
- description:
- zh: "占总募集资金的百分比(例如'30%'、'约三分之一')"
- required: false
- default: ""
- - name: timeline
- type: "string"
- description:
- zh: "预计资金使用时间表(例如'12-18 个月'、'2025-2026 财年')"
- required: false
- default: ""
- - name: description
- type: "string"
- description:
- zh: "资金具体使用方式的详细说明"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的 IPO 分析师,请从招股说明书中提取所有募集资金用途分配信息。
- rules:
- zh: |
- 1. 每个条目对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 提取每一项资金用途类别和具体项目
- 4. 捕捉分配金额和百分比
- 5. 提取资金使用时间表(如有说明)
- 6. 保留资金使用方式的详细描述
-
-display:
- label: "{use_category}: {allocated_amount}"
diff --git a/hyperextract/templates/presets/finance/research_note_summary.yaml b/hyperextract/templates/presets/finance/research_note_summary.yaml
deleted file mode 100644
index 6cfd53a..0000000
--- a/hyperextract/templates/presets/finance/research_note_summary.yaml
+++ /dev/null
@@ -1,118 +0,0 @@
-name: "ResearchNoteSummary"
-autotype: model
-tag: [finance]
-
-language: zh
-
-description:
- zh: "研究报告摘要 - 从股票研究报告中提取核心投资论点"
-
-schema:
- fields:
- - name: company_name
- type: "string"
- description:
- zh: "被覆盖公司的名称"
- required: false
- default: ""
- - name: ticker
- type: "string"
- description:
- zh: "股票代码(例如 'AAPL'、'NVDA')"
- required: false
- default: ""
- - name: analyst_name
- type: "string"
- description:
- zh: "首席分析师的姓名"
- required: false
- default: ""
- - name: research_firm
- type: "string"
- description:
- zh: "研究机构名称(例如 '高盛'、'摩根士丹利')"
- required: false
- default: ""
- - name: report_date
- type: "string"
- description:
- zh: "报告发布日期"
- required: false
- default: ""
- - name: rating
- type: "string"
- description:
- zh: "分析师评级:'买入'、'增持'、'持有'、'中性'、'卖出'、'减持'"
- required: false
- default: ""
- - name: prior_rating
- type: "string"
- description:
- zh: "如有变更,之前的评级"
- required: false
- default: ""
- - name: target_price
- type: "string"
- description:
- zh: "当前目标价(例如 '$150.00')"
- required: false
- default: ""
- - name: prior_target_price
- type: "string"
- description:
- zh: "如有变更,之前的目标价"
- required: false
- default: ""
- - name: current_price
- type: "string"
- description:
- zh: "报告发布时的股价"
- required: false
- default: ""
- - name: investment_thesis
- type: "string"
- description:
- zh: "核心投资论点或评级的关键论据"
- required: false
- default: ""
- - name: key_catalysts
- type: "array"
- description:
- zh: "已识别的近期催化剂(例如 ['Q4 业绩超预期', '新产品发布', '监管审批'])"
- required: false
- default: ""
- - name: key_risks
- type: "array"
- description:
- zh: "分析师强调的主要风险"
- required: false
- default: ""
- - name: revenue_estimate
- type: "string"
- description:
- zh: "分析师对当前/下一财年的收入预测"
- required: false
- default: ""
- - name: eps_estimate
- type: "string"
- description:
- zh: "分析师对当前/下一财年的每股收益预测"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的股票研究分析师,请从研究报告中提取核心投资论点、评级、目标价和关键论据。
- rules:
- zh: |
- 1. 每个对象对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 提取分析师的评级及任何评级变更
- 4. 捕获目标价以及变更前的目标价(如有变更)
- 5. 简洁地总结核心投资论点
- 6. 列出分析师识别的关键催化剂和风险
- 7. 在提及时提取财务预测(收入、每股收益)
-
-display:
- label: "{ticker} - {rating} (目标价: {target_price})"
diff --git a/hyperextract/templates/presets/finance/risk_assessment.yaml b/hyperextract/templates/presets/finance/risk_assessment.yaml
deleted file mode 100644
index c6bca8e..0000000
--- a/hyperextract/templates/presets/finance/risk_assessment.yaml
+++ /dev/null
@@ -1,123 +0,0 @@
-name: "RiskAssessmentGraph"
-autotype: graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "风险评估图谱 - 从企业披露文件中提取风险因子及其财务影响传导路径"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "实体类别:'风险因素'、'财务指标'、'运营结果'"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "实体的详细描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体名称"
- required: true
- default: ""
- - name: relation_type
- type: "string"
- description:
- zh: "关系类型:'导致'、'影响'、'提高'、'降低'、'改善'、'削弱' 等"
- required: true
- default: ""
- - name: transmission_mechanism
- type: "string"
- description:
- zh: "传导机制说明"
- required: true
- default: ""
- - name: likelihood
- type: "string"
- description:
- zh: "发生可能性:高/中/低"
- required: true
- default: ""
- - name: severity
- type: "string"
- description:
- zh: "影响严重程度:高/中/低,或量化影响"
- required: false
- default: ""
- - name: mitigation
- type: "string"
- description:
- zh: "缓解措施或应对策略"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的金融风险分析师,请从企业披露文件中提取风险因素、财务指标、运营结果等实体,以及它们之间的风险传导关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别风险因素:运营风险、市场风险、财务风险、合规风险、外部风险
- 6. 识别财务指标:营收、利润、毛利率、现金流等
- 7. 识别运营结果:产能利用率、交付周期、客户流失率等
- 8. 映射风险到财务影响的传导路径
- 9. 提取发生可能性和影响严重程度
- 10. 捕获管理层提及的缓解措施
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别风险因素:供应链中断、原材料价格波动、汇率变动等
- 4. 识别财务指标:营业收入、净利润、毛利率、现金流等
- 5. 识别运营结果:产能利用率、交付延迟、客户流失等
- 6. 为每个实体标注正确的类别
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 边的 source 和 target 必须完全使用下方实体列表中的名称,不能创造新名称
- 4. 源实体通常是风险因素,目标实体是受影响的财务指标或运营结果
- 5. 描述风险传导到目标的机制(如何影响)
- 6. 提取发生可能性(高/中/低)
- 7. 提取影响严重程度或量化影响
- 8. 捕获提及的缓解措施或应对策略
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relation_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relation_type}"
diff --git a/hyperextract/templates/presets/finance/risk_factor_list.yaml b/hyperextract/templates/presets/finance/risk_factor_list.yaml
deleted file mode 100644
index 66a0466..0000000
--- a/hyperextract/templates/presets/finance/risk_factor_list.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-name: "RiskFactorList"
-autotype: list
-tag: [finance]
-
-language: zh
-
-description:
- zh: "风险因素列表 - 从股票研究报告中提取下行风险"
-
-item_schema:
- fields:
- - name: risk_name
- type: "string"
- description:
- zh: "风险的简洁名称(例如 '欧盟监管收紧'、'强势美元带来的汇率逆风')"
- required: true
- default: ""
- - name: risk_category
- type: "string"
- description:
- zh: "类别:'监管'、'竞争'、'宏观经济'、'运营'、'汇率/货币'、'地缘政治'、'技术'、'法律/诉讼'、'ESG'、'执行'"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "风险情景的详细描述"
- required: true
- default: ""
- - name: potential_impact
- type: "string"
- description:
- zh: "估计的财务影响(例如 '收入下行 3-5%'、'每股收益风险 $0.50')"
- required: false
- default: ""
- - name: probability
- type: "string"
- description:
- zh: "分析师的概率评估:'高'、'中等'、'低'"
- required: false
- default: ""
- - name: time_horizon
- type: "string"
- description:
- zh: "风险可能兑现的时间(例如 '近期'、'2025 年'、'12-18 个月')"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的风险分析师,请从文本中提取所有下行风险和风险因素。
- rules:
- zh: |
- 1. 每个条目对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 提取每一个不同的风险因素
- 4. 对每项风险进行适当分类
- 5. 在提供量化影响估算时予以捕获
- 6. 记录概率评估和时间范围
-
-display:
- label: "[{risk_category}] {risk_name}"
diff --git a/hyperextract/templates/presets/finance/segment_performance_list.yaml b/hyperextract/templates/presets/finance/segment_performance_list.yaml
deleted file mode 100644
index dbf7271..0000000
--- a/hyperextract/templates/presets/finance/segment_performance_list.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
-name: "SegmentPerformanceList"
-autotype: list
-tag: [finance]
-
-language: zh
-
-description:
- zh: "业务板块业绩列表 - 按业务板块提取营收和关键指标"
-
-item_schema:
- fields:
- - name: segment_name
- type: "string"
- description:
- zh: "业务板块或地理区域名称(例如 '美洲'、'云服务'、'iPhone')"
- required: true
- default: ""
- - name: segment_type
- type: "string"
- description:
- zh: "类型:'业务板块'、'地理区域'、'产品线'、'经营分部'"
- required: true
- default: ""
- - name: revenue
- type: "string"
- description:
- zh: "该期间的板块营收(例如 '482亿美元')"
- required: false
- default: ""
- - name: operating_income
- type: "string"
- description:
- zh: "板块营业利润或经营利润"
- required: false
- default: ""
- - name: revenue_growth
- type: "string"
- description:
- zh: "同比或环比营收增长率(例如 '+12%'、'-3% 同比')"
- required: false
- default: ""
- - name: key_metrics
- type: "array"
- description:
- zh: "板块特定的关键绩效指标(例如 ['订阅用户:2.3亿', 'ARPU:$14.99', '流失率:2.1%'])"
- required: false
- default: ""
- - name: commentary
- type: "string"
- description:
- zh: "管理层对板块业绩或展望的评论"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的财务分析师,请从 SEC 申报文件中提取每个业务板块或地理区域的业绩数据。
- rules:
- zh: |
- 1. 每个条目对应一个独立的实体,禁止合并
- 2. 实体名称与原文保持一致
- 3. 提取每个可识别板块的营收和营业利润
- 4. 捕获增长率和与前期的对比数据
- 5. 提取板块特定的关键绩效指标和度量
- 6. 保留管理层的板块评论
-
-display:
- label: "{segment_name} ({segment_type}) | {revenue}"
diff --git a/hyperextract/templates/presets/finance/shareholder_structure.yaml b/hyperextract/templates/presets/finance/shareholder_structure.yaml
deleted file mode 100644
index 1222ee9..0000000
--- a/hyperextract/templates/presets/finance/shareholder_structure.yaml
+++ /dev/null
@@ -1,113 +0,0 @@
-name: "ShareholderStructure"
-autotype: graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "股东结构图谱 - 从招股说明书或委托声明文件中提取股权结构"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(例如个人、基金、控股公司、信托)"
- required: true
- default: ""
- - name: entity_type
- type: "string"
- description:
- zh: "类型:个人、机构投资者、控股公司、风险投资、私募股权、信托、政府实体、发行公司"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "附加信息(例如'联合创始人兼 CEO'、'B 轮领投机构')"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "持有方/母公司实体名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "被持有方/子公司实体名称"
- required: true
- default: ""
- - name: relationship_type
- type: "string"
- description:
- zh: "类型:直接持股、间接持股、实益所有权、投票权控制、董事会席位、母子公司"
- required: true
- default: ""
- - name: ownership_percentage
- type: "string"
- description:
- zh: "持股比例(例如'15.3%'、'51%'、'控股权')"
- required: false
- default: ""
- - name: share_class
- type: "string"
- description:
- zh: "股份类别(例如'A 类普通股'、'B 类(10 倍投票权)'、'C 轮优先股')"
- required: false
- default: ""
- - name: voting_power
- type: "string"
- description:
- zh: "投票权百分比(若与持股比例不同,例如'65% 投票权')"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的公司治理分析师,请从招股说明书或委托声明文件中提取股权结构。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别所有重要股东(5% 以上实益所有人)
- 6. 提取持股比例和股份类别
- 7. 映射母子公司和控股公司结构
- 8. 注意双重股权结构和投票权差异
- 9. 捕捉锁定期和 IPO 后限制条款
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别个人、机构投资者、控股公司和信托
- 4. 识别发行公司本身
- 5. 按类型对每个实体进行分类
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 将持有方连接到其持有的资产
- 4. 提取持股比例和股份类别
- 5. 注意投票权差异
- 6. 捕捉锁定期
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationship_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({entity_type})"
- edge_label: "{relationship_type} {ownership_percentage}"
diff --git a/hyperextract/templates/presets/finance/supply_chain.yaml b/hyperextract/templates/presets/finance/supply_chain.yaml
deleted file mode 100644
index db2fed8..0000000
--- a/hyperextract/templates/presets/finance/supply_chain.yaml
+++ /dev/null
@@ -1,97 +0,0 @@
-name: "SupplyChainGraph"
-autotype: graph
-tag: [finance]
-
-language: zh
-
-description:
- zh: "供应链图谱 - 从 SEC 申报文件中提取供应链实体及其关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(公司或供应商)"
- required: true
- default: ""
- - name: entity_type
- type: "string"
- description:
- zh: "类型:客户、供应商、战略伙伴、分销商、本公司"
- required: true
- default: ""
- - name: details
- type: "string"
- description:
- zh: "地理管辖区、认证信息及合规说明"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "上游供应商或提供方"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "下游买方或需求方"
- required: true
- default: ""
- - name: relationship_type
- type: "string"
- description:
- zh: "类型:供应、采购、分销、战略合作"
- required: true
- default: ""
- - name: product_service
- type: "string"
- description:
- zh: "被供应或交易的内容,例如锂芯片、物流服务等"
- required: true
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的供应链分析师,请从文本中提取供应链实体及其关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别供应商、客户和伙伴
- 6. 提取交易类型及产品
- 7. 将依赖度、交易量及地缘政治风险汇总
- rules_for_nodes:
- zh: |
- 1. 每个节点对应一个独立实体
- 2. 实体名称与原文保持一致
- 3. 识别公司及合作伙伴
- 4. 分类角色(客户、供应商、战略伙伴、分销商)
- 5. 记录地区及认证至 details
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 通过产品/服务连接实体
- 4. 综合评估依赖度、交易量及风险(关税、单一来源)
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationship_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "one_stage"
-
-display:
- node_label: "{name} ({entity_type})"
- edge_label: "{relationship_type}"
diff --git a/hyperextract/templates/presets/general/clause_list.yaml b/hyperextract/templates/presets/general/clause_list.yaml
deleted file mode 100644
index 50f868a..0000000
--- a/hyperextract/templates/presets/general/clause_list.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
-name: "ClauseList"
-autotype: list
-tag: [general]
-
-language: zh
-
-description:
- zh: "规章条文清单 - 将规章制度拆解为逐条的原子化条文,方便快速索引"
-
-item_schema:
- fields:
- - name: clauseId
- type: "string"
- description:
- zh: "条文编号,如第1条、第2.1款"
- - name: title
- type: "string"
- description:
- zh: "条目标题/主题"
- required: false
- - name: content
- type: "string"
- description:
- zh: "条文内容"
- - name: category
- type: "string"
- description:
- zh: "条文分类:总则、权利义务、程序、处罚、附则、其他"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的规章制度条文拆解专家,请将文本拆解为逐条的原子化条文。
-
- rules:
- zh: |
- 1. 将规章制度按其自然结构拆解为独立的条文
- 2. 为每条条文分配编号(如第1条、第2.1款等)
- 3. 提取条文的内容
- 4. 为条文添加适当的标题或主题(如有)
- 5. 为每条条文指定分类:总则、权利义务、程序、处罚、附则、其他
- 6. 保持条文内容与原文一致,不要遗漏任何条文
-
-display:
- label: "clauseId"
diff --git a/hyperextract/templates/presets/general/compliance_logic.yaml b/hyperextract/templates/presets/general/compliance_logic.yaml
deleted file mode 100644
index 99a8e14..0000000
--- a/hyperextract/templates/presets/general/compliance_logic.yaml
+++ /dev/null
@@ -1,91 +0,0 @@
-name: "ComplianceLogic"
-autotype: hypergraph
-tag: [general]
-
-language: zh
-
-description:
- zh: "合规行为超图 - 建模 '在何种条件下,何种主体,必须/禁止执行何种操作' 的复杂逻辑"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "要素名称,文本中出现的精确名称"
- - name: category
- type: "string"
- description:
- zh: "要素类型:主体、操作、条件、其他"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: ruleType
- type: "string"
- description:
- zh: "规则类型:必须、禁止、允许、其他"
- - name: participants
- type: "array"
- description:
- zh: "参与要素名称列表,必须使用已提取节点的 name"
- - name: action
- type: "string"
- description:
- zh: "要求执行或禁止的操作内容"
- - name: condition
- type: "string"
- description:
- zh: "适用条件/前置要求"
- required: false
- - name: consequence
- type: "string"
- description:
- zh: "违规后果/奖励措施"
- required: false
- - name: sourceClause
- type: "string"
- description:
- zh: "规则来源条款"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的合规评估员,请从文本中提取合规要素和规则。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已提取节点创建规则
-
- rules_for_nodes:
- zh: |
- - 主体:执行动作的实体(个人、部门、组织、角色等)
- - 操作:具体的行为动作(提交、审批、执行、禁止等)
- - 条件:规则适用的时间、地点、状态、数量等前提条件
- - 其他:不属于上述类别的要素(文书、文件、状态、结果等)
-
- rules_for_edges:
- zh: |
- - 必须:必须执行的动作
- - 禁止:禁止执行的动作
- - 允许:允许执行的动作
- - 其他:不属于上述类别的规则
-
-identifiers:
- node_id: "name"
- edge_id: "{ruleType}_{action}_{participants}"
- edge_members: "participants"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "[{ruleType}] {action}"
diff --git a/hyperextract/templates/presets/general/concept_hierarchy.yaml b/hyperextract/templates/presets/general/concept_hierarchy.yaml
deleted file mode 100644
index 95e7e3d..0000000
--- a/hyperextract/templates/presets/general/concept_hierarchy.yaml
+++ /dev/null
@@ -1,80 +0,0 @@
-name: "ConceptHierarchy"
-autotype: graph
-tag: [general]
-
-language: zh
-
-description:
- zh: "概念层级图 - 构建上下位关系或组成关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "概念名称"
- - name: category
- type: "string"
- description:
- zh: "概念类型:核心概念、子概念、属性、实例、其他"
- - name: description
- type: "string"
- description:
- zh: "概念简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "父概念/整体概念"
- - name: target
- type: "string"
- description:
- zh: "子概念/部分概念"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:上下位(Subclass-Of)、组成(Part-Of)、实例(Instance-Of)、其他(Other)"
- - name: details
- type: "string"
- description:
- zh: "关系详细说明"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的概念结构分析专家,请从文本中提取概念及其层级关系。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的概念,禁止将多个概念合并为一个节点
- 2. 概念名称与原文保持一致
- 3. 仅从提取的概念中创建边
-
- rules_for_nodes:
- zh: |
- - 提取所有概念
- - 为每个概念指定类型
-
- rules_for_edges:
- zh: |
- - 上下位(Subclass-Of):表示概念的继承关系
- - 组成(Part-Of):表示整体与部分的关系
- - 实例(Instance-Of):表示概念与实例的关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/general/cross_reference_net.yaml b/hyperextract/templates/presets/general/cross_reference_net.yaml
deleted file mode 100644
index ef37f91..0000000
--- a/hyperextract/templates/presets/general/cross_reference_net.yaml
+++ /dev/null
@@ -1,81 +0,0 @@
-name: "CrossReferenceNet"
-autotype: graph
-tag: [general]
-
-language: zh
-
-description:
- zh: "交叉引用网络 - 映射概念之间的超链接或相互引用关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "概念/条目名称"
- - name: type
- type: "string"
- description:
- zh: "节点类型:条目、章节、概念、人物、地点、其他"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源条目/概念"
- - name: target
- type: "string"
- description:
- zh: "被引用条目/概念"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:Hyperlink(超链接)、Reference(引用)、SeeAlso(参见)、Related(相关)、Other(其他)"
- - name: context
- type: "string"
- description:
- zh: "引用上下文描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的知识网络分析专家,请从文本中提取概念/条目及其相互引用关系。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从提取的节点中创建边
-
- rules_for_nodes:
- zh: |
- - 提取所有被提及的概念或条目
- - 为每个节点指定类型
-
- rules_for_edges:
- zh: |
- - Hyperlink:超链接关系
- - Reference:引用关系
- - SeeAlso:参见关系
- - Related:相关关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({type})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/general/encyclopedia_item.yaml b/hyperextract/templates/presets/general/encyclopedia_item.yaml
deleted file mode 100644
index e047e2d..0000000
--- a/hyperextract/templates/presets/general/encyclopedia_item.yaml
+++ /dev/null
@@ -1,68 +0,0 @@
-name: "EncyclopediaItem"
-autotype: model
-tag: [general]
-
-language: zh
-
-description:
- zh: "百科条目 - 针对单一主体提取结构化的属性信息(类似信息框 Infobox)"
-
-schema:
- fields:
- - name: title
- type: "string"
- description:
- zh: "条目标题"
- - name: entityType
- type: "string"
- description:
- zh: "实体类型:人物、地点、组织、事件、概念、物品、其他"
- - name: alternativeNames
- type: "array"
- description:
- zh: "别名、俗称、外文名称"
- required: false
- - name: category
- type: "array"
- description:
- zh: "分类标签"
- required: false
- - name: summary
- type: "string"
- description:
- zh: "摘要/简介"
- required: false
- - name: attributes
- type: "array"
- description:
- zh: "关键属性列表,每个元素格式为'属性名: 属性值'"
- required: false
- - name: keyEvents
- type: "array"
- description:
- zh: "重要事件/里程碑"
- required: false
- - name: relatedConcepts
- type: "array"
- description:
- zh: "相关概念/条目"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的百科全书编辑,请从文本中提取单一主体的结构化属性信息,构建百科条目信息框。
-
- rules:
- zh: |
- 1. 识别文本的核心主体(人物、地点、组织、事件、概念等)
- 2. 为主体指定类型
- 3. 提取所有别名、俗称或外文名称
- 4. 提取分类标签
- 5. 撰写 100-200 字的摘要
- 6. 提取关键属性
- 7. 提取重要事件或里程碑
- 8. 提取相关概念或条目
-
-display:
- label: "title"
diff --git a/hyperextract/templates/presets/general/entity_registry.yaml b/hyperextract/templates/presets/general/entity_registry.yaml
deleted file mode 100644
index 9072f58..0000000
--- a/hyperextract/templates/presets/general/entity_registry.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: "EntityRegistry"
-autotype: set
-tag: [general]
-
-language: zh
-
-description:
- zh: "实体注册表 - 去重并汇总文本中出现的所有唯一实体"
-
-item_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,保持与原文一致"
- - name: category
- type: "string"
- description:
- zh: "实体类型:人物、机构、地点、产品、概念、其他"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的实体识别专家,请从文本中提取所有唯一实体,形成实体注册表。
-
- rules:
- zh: |
- 1. 提取所有实体:人物、机构、地点、产品、概念等
- 2. 为每个实体指定类型
- 3. 保持实体名称与原文一致
- 4. 为每个实体添加简要描述
- 5. 去重:同一实体只保留一条记录
-
-identifiers:
- item_id: "name"
-
-
-display:
- label: "name"
diff --git a/hyperextract/templates/presets/general/keyword_list.yaml b/hyperextract/templates/presets/general/keyword_list.yaml
deleted file mode 100644
index aaf0870..0000000
--- a/hyperextract/templates/presets/general/keyword_list.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: "KeywordList"
-autotype: list
-tag: [general]
-
-language: zh
-
-description:
- zh: "关键词列表 - 从文本中提取关键词并附带分类、出现频次信息"
-
-item_schema:
- fields:
- - name: term
- type: "string"
- description:
- zh: "关键词"
- - name: category
- type: "string"
- description:
- zh: "分类:核心概念、术语、人名、机构名、其他"
- - name: description
- type: "string"
- description:
- zh: "关键词简要描述或上下文说明"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的关键词提取专家,请从文本中提取所有关键词并附带分类和描述信息。
-
- rules:
- zh: |
- 1. 提取文本中的所有关键词和核心短语
- 2. 为每个关键词指定分类
- 3. 为每个关键词添加简要描述
-
-display:
- label: "term"
diff --git a/hyperextract/templates/presets/general/knowledge_graph.yaml b/hyperextract/templates/presets/general/knowledge_graph.yaml
deleted file mode 100644
index 3353b23..0000000
--- a/hyperextract/templates/presets/general/knowledge_graph.yaml
+++ /dev/null
@@ -1,81 +0,0 @@
-name: "KnowledgeGraph"
-autotype: graph
-tag: [general]
-
-language: zh
-
-description:
- zh: "通用知识图谱 - 从任意文本中提取实体与关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如人名、机构名、产品名"
- - name: category
- type: "string"
- description:
- zh: "实体类型:人物、机构、地点、产品、概念、其他"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体"
- - name: target
- type: "string"
- description:
- zh: "目标实体"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:属于、位于、合作、竞争、发明、创建、相关等"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的知识图谱提取专家,请从文本中提取实体及其关系。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从提取的实体中创建边
-
- rules_for_nodes:
- zh: |
- - 提取所有实体
- - 为每个实体指定类型
-
- rules_for_edges:
- zh: |
- - 属于:表示归属关系
- - 位于:表示地理位置关系
- - 合作:表示合作关系
- - 竞争:表示竞争关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/general/life_event_timeline.yaml b/hyperextract/templates/presets/general/life_event_timeline.yaml
index 155135c..ae2f88d 100644
--- a/hyperextract/templates/presets/general/life_event_timeline.yaml
+++ b/hyperextract/templates/presets/general/life_event_timeline.yaml
@@ -1,103 +1,99 @@
-name: "LifeEventTimeline"
-autotype: temporal_graph
-tag: [general]
-
language: zh
-
+name: LifeEventTimeline
+type: temporal_graph
+tags: [general]
description:
- zh: "生活事件时间线 - 提取带时间戳的事件,并按时间顺序排列"
+ zh: '生活事件时间线 - 提取带时间戳的事件,并按时间顺序排列'
-node_schema:
- fields:
+output:
+ description:
+ zh: '包含实体和事件关系的时间线'
+ entities:
+ description:
+ zh: '提取的实体列表'
+ fields:
- name: name
- type: "string"
+ type: string
description:
- zh: "实体名称"
+ zh: '实体名称'
- name: type
- type: "string"
+ type: string
description:
- zh: "实体类型:人物、地点、组织、物品、概念、其他"
+ zh: '实体类型:人物、地点、组织、物品、概念、其他'
- name: description
- type: "string"
+ type: string
description:
- zh: "简要描述"
+ zh: '简要描述'
required: false
-
-edge_schema:
- fields:
+ relations:
+ description:
+ zh: '提取的事件关系列表'
+ fields:
- name: source
- type: "string"
+ type: string
description:
- zh: "事件主体/相关实体"
+ zh: '事件主体/相关实体'
- name: target
- type: "string"
+ type: string
description:
- zh: "事件对象/相关实体"
+ zh: '事件对象/相关实体'
- name: eventType
- type: "string"
+ type: string
description:
- zh: "事件类型:出生、逝世、教育、工作、成就、交往、旅行、其他"
+ zh: '事件类型:出生、逝世、教育、工作、成就、交往、旅行、其他'
- name: eventDate
- type: "string"
+ type: string
description:
- zh: "事件日期,格式为年-月-日或年份"
+ zh: '事件日期,格式为年-月-日或年份'
required: false
- name: details
- type: "string"
+ type: string
description:
- zh: "事件详细描述"
+ zh: '事件详细描述'
required: false
-guide:
+guideline:
target:
- zh: |
- 你是一位专业的传记年表专家,请从文本中提取人物、地点、组织等实体以及生活事件。
-
+ zh: '你是一位专业的传记年表专家,请从文本中提取人物、地点、组织等实体以及生活事件。'
rules:
- zh: |
- 1. 提取所有相关实体
- 2. 为每个实体指定类型
- 3. 仅从提取的实体中创建事件边
-
- rules_for_nodes:
- zh: |
- - 人物、地点、组织、物品、概念等实体
-
- rules_for_edges:
- zh: |
- - 事件类型:出生、逝世、教育、工作、成就、交往、旅行、其他
- - 时间信息为可选,仅在文本中明确提及时才提取
-
+ zh:
+ - '提取所有相关实体'
+ - '为每个实体指定类型'
+ - '仅从提取的实体中创建事件边'
+ rules_for_entities:
+ zh:
+ - '人物、地点、组织、物品、概念等实体'
+ rules_for_relations:
+ zh:
+ - '事件类型:出生、逝世、教育、工作、成就、交往、旅行、其他'
+ - '时间信息为可选,仅在文本中明确提及时才提取'
rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期):
- - "去年" → {observation_time} 前一年
- - "今年" → {observation_time} 所属年份
- - "明年" → {observation_time} 后一年
- - "昨天/今天/明天" → {observation_time} 前/当/后一天
- - "十年前/五年后" → {observation_time} 前/后相应年数
- - "年初/年末" → 当年 1月1日/12月31日
- - "朝代" → 保留朝代名称
-
- 2. 明确日期:保持原格式
- - 年份(如 429年、2023年)→ 429、2023
- - 年-月-日 → 保持原格式
-
- 3. 缺失时间:留空
+ zh:
+ - '当前观察日期:{observation_time}'
+ - '相对时间解析(基于观察日期):'
+ - '- "去年" → {observation_time} 前一年'
+ - '- "今年" → {observation_time} 所属年份'
+ - '- "明年" → {observation_time} 后一年'
+ - '- "昨天/今天/明天" → {observation_time} 前/当/后一天'
+ - '- "十年前/五年后" → {observation_time} 前/后相应年数'
+ - '- "年初/年末" → 当年 1月1日/12月31日'
+ - '- "朝代" → 保留朝代名称'
+ - '明确日期:保持原格式'
+ - '- 年份(如 429年、2023年)→ 429、2023'
+ - '- 年-月-日 → 保持原格式'
+ - '缺失时间:留空'
identifiers:
- node_id: "name"
- edge_id: "{source}|{eventType}|{details}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "eventDate"
+ entity_id: name
+ relation_id: '{source}|{eventType}|{details}'
+ relation_members:
+ source: source
+ target: target
+ time_field: eventDate
options:
- extraction_mode: "two_stage"
+ extraction_mode: two_stage
display:
- node_label: "{name} ({type})"
- edge_label: "{eventType}"
+ entity_label: '{name} ({type})'
+ relation_label: '{eventType}'
diff --git a/hyperextract/templates/presets/general/operational_procedure.yaml b/hyperextract/templates/presets/general/operational_procedure.yaml
deleted file mode 100644
index 5219aad..0000000
--- a/hyperextract/templates/presets/general/operational_procedure.yaml
+++ /dev/null
@@ -1,98 +0,0 @@
-name: "OperationalProcedure"
-autotype: graph
-tag: [general]
-
-language: zh
-
-description:
- zh: "执行程序流程图 - 提取规章中规定的申报、审批或操作的具体先后步骤"
-
-node_schema:
- fields:
- - name: stepId
- type: "string"
- description:
- zh: "步骤编号,如步骤1、步骤2"
- - name: name
- type: "string"
- description:
- zh: "步骤名称"
- - name: description
- type: "string"
- description:
- zh: "步骤详细描述"
- - name: role
- type: "string"
- description:
- zh: "执行角色"
- required: false
- - name: inputRequired
- type: "string"
- description:
- zh: "所需输入/材料"
- required: false
- - name: outputResult
- type: "string"
- description:
- zh: "输出/结果"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源步骤编号"
- - name: target
- type: "string"
- description:
- zh: "目标步骤编号"
- - name: condition
- type: "string"
- description:
- zh: "转换条件"
- required: false
- - name: details
- type: "string"
- description:
- zh: "详细说明"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的流程分析专家,请从文本中提取执行程序的步骤和转换关系。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的步骤,禁止将多个步骤合并为一个节点
- 2. 步骤名称与原文保持一致
- 3. 仅从提取的步骤中创建转换边
-
- rules_for_nodes:
- zh: |
- - 提取所有流程步骤
- - 为每个步骤分配编号
- - 记录步骤名称和描述
- - 记录执行角色(如有)
- - 记录所需输入或材料(如有)
- - 记录输出或结果(如有)
-
- rules_for_edges:
- zh: |
- - 记录步骤之间的先后关系
- - 记录转换条件(如有)
-
-identifiers:
- node_id: "stepId"
- edge_id: "{source}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{stepId}: {name}"
- edge_label: "condition"
diff --git a/hyperextract/templates/presets/general/penalty_mapping.yaml b/hyperextract/templates/presets/general/penalty_mapping.yaml
deleted file mode 100644
index 19077d6..0000000
--- a/hyperextract/templates/presets/general/penalty_mapping.yaml
+++ /dev/null
@@ -1,81 +0,0 @@
-name: "PenaltyMapping"
-autotype: graph
-tag: [general]
-
-language: zh
-
-description:
- zh: "违规处罚因果链 - 描述从'违规行为'到'处理程序'再到'最终结果'的演变路径"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "节点名称"
- - name: type
- type: "string"
- description:
- zh: "节点类型:违规行为、处理程序、处罚结果、其他"
- - name: description
- type: "string"
- description:
- zh: "详细描述"
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源节点名称"
- - name: target
- type: "string"
- description:
- zh: "目标节点名称"
- - name: relation
- type: "string"
- description:
- zh: "关系类型:导致、触发、执行、产生、其他"
- - name: details
- type: "string"
- description:
- zh: "详细说明"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的处罚逻辑分析专家,请从文本中提取违规处罚的因果链。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从提取的节点中创建因果路径边
-
- rules_for_nodes:
- zh: |
- - 违规行为:违反规定的行为
- - 处理程序:处理违规的流程
- - 处罚结果:最终的处罚结果
-
- rules_for_edges:
- zh: |
- - 导致:表示因果关系
- - 触发:表示引发关系
- - 执行:表示执行关系
- - 产生:表示结果关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relation}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({type})"
- edge_label: "{relation}"
diff --git a/hyperextract/templates/presets/general/penalty_registry.yaml b/hyperextract/templates/presets/general/penalty_registry.yaml
deleted file mode 100644
index bdbe661..0000000
--- a/hyperextract/templates/presets/general/penalty_registry.yaml
+++ /dev/null
@@ -1,53 +0,0 @@
-name: "PenaltyRegistry"
-autotype: set
-tag: [general]
-
-language: zh
-
-description:
- zh: "违规处罚对照表 - 去重汇总特定的违规行为及其对应的后果,形成清晰的处罚台账"
-
-item_schema:
- fields:
- - name: violation
- type: "string"
- description:
- zh: "违规行为描述"
- - name: severity
- type: "string"
- description:
- zh: "严重程度:轻微、一般、严重、特别严重"
- - name: penalty
- type: "string"
- description:
- zh: "处罚措施"
- - name: applicableClause
- type: "string"
- description:
- zh: "适用条款"
- required: false
- - name: notes
- type: "string"
- description:
- zh: "备注说明"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的合规分析专家,请从文本中提取所有违规行为及其对应的处罚措施,形成违规处罚对照表。
-
- rules:
- zh: |
- 1. 提取所有违规行为及其对应的处罚措施
- 2. 为每条违规行为指定严重程度
- 3. 保持违规行为和处罚措施的准确性
- 4. 记录适用的条款(如有)
- 5. 添加备注说明(如有)
- 6. 去重:相同的违规行为和处罚措施组合只保留一条
-
-identifiers:
- item_id: "violation"
-
-display:
- label: "violation"
diff --git a/hyperextract/templates/presets/general/personal_profile.yaml b/hyperextract/templates/presets/general/personal_profile.yaml
deleted file mode 100644
index 7928ff6..0000000
--- a/hyperextract/templates/presets/general/personal_profile.yaml
+++ /dev/null
@@ -1,89 +0,0 @@
-name: "PersonalProfile"
-autotype: model
-tag: [general]
-
-language: zh
-
-description:
- zh: "个人档案 - 聚合人物的静态属性(生卒年、学历、核心身份)"
-
-schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "姓名"
- - name: gender
- type: "string"
- description:
- zh: "性别"
- required: false
- - name: birthDate
- type: "string"
- description:
- zh: "出生日期,格式为年-月-日或年份"
- required: false
- - name: deathDate
- type: "string"
- description:
- zh: "逝世日期,格式为年-月-日或年份"
- required: false
- - name: nationality
- type: "string"
- description:
- zh: "国籍"
- required: false
- - name: birthPlace
- type: "string"
- description:
- zh: "出生地"
- required: false
- - name: education
- type: "array"
- description:
- zh: "教育经历"
- required: false
- - name: occupations
- type: "array"
- description:
- zh: "职业/身份"
- required: false
- - name: coreIdentity
- type: "array"
- description:
- zh: "核心身份/标签"
- required: false
- - name: majorAchievements
- type: "array"
- description:
- zh: "主要成就"
- required: false
- - name: affiliations
- type: "array"
- description:
- zh: "所属组织/机构"
- required: false
- - name: summary
- type: "string"
- description:
- zh: "个人简介"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的人物档案编辑,请从文本中提取该人物的静态属性信息,构建个人档案。
-
- rules:
- zh: |
- 1. 提取姓名、性别、出生日期、逝世日期、国籍、出生地等基本信息
- 2. 提取教育经历
- 3. 提取职业或身份信息
- 4. 提取核心身份标签
- 5. 提取主要成就
- 6. 提取所属组织或机构
- 7. 撰写 100-200 字的个人简介
- 8. 若信息缺失时留空,不要编造
-
-display:
- label: "name"
diff --git a/hyperextract/templates/presets/general/regulation_profile.yaml b/hyperextract/templates/presets/general/regulation_profile.yaml
deleted file mode 100644
index b095754..0000000
--- a/hyperextract/templates/presets/general/regulation_profile.yaml
+++ /dev/null
@@ -1,86 +0,0 @@
-name: "RegulationProfile"
-autotype: model
-tag: [general]
-
-language: zh
-
-description:
- zh: "规章元数据快照 - 提取制度的名称、版本、适用范围、生效日期及核心宗旨"
-
-schema:
- fields:
- - name: title
- type: "string"
- description:
- zh: "规章名称"
- - name: version
- type: "string"
- description:
- zh: "版本号"
- required: false
- - name: issuer
- type: "string"
- description:
- zh: "发布机构"
- required: false
- - name: issueDate
- type: "string"
- description:
- zh: "发布日期"
- required: false
- - name: effectiveDate
- type: "string"
- description:
- zh: "生效日期"
- required: false
- - name: expiryDate
- type: "string"
- description:
- zh: "失效日期"
- required: false
- - name: scope
- type: "array"
- description:
- zh: "适用范围"
- required: false
- - name: targetAudience
- type: "array"
- description:
- zh: "适用对象"
- required: false
- - name: corePurpose
- type: "string"
- description:
- zh: "核心宗旨/目的"
- required: false
- - name: keywords
- type: "array"
- description:
- zh: "关键词/标签"
- required: false
- - name: relatedRegulations
- type: "array"
- description:
- zh: "关联规章"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的规章制度分析专家,请从文本中提取该规章制度的元数据信息,构建规章元数据快照。
-
- rules:
- zh: |
- 1. 提取规章的完整名称
- 2. 提取版本号(如有)
- 3. 提取发布机构
- 4. 提取发布日期、生效日期、失效日期(如有)
- 5. 提取适用范围
- 6. 提取适用对象
- 7. 提取核心宗旨或目的
- 8. 提取关键词或标签
- 9. 提取关联的其他规章
- 10. 信息缺失时留空,不要编造
-
-display:
- label: "title"
diff --git a/hyperextract/templates/presets/general/social_network.yaml b/hyperextract/templates/presets/general/social_network.yaml
deleted file mode 100644
index 07d613d..0000000
--- a/hyperextract/templates/presets/general/social_network.yaml
+++ /dev/null
@@ -1,90 +0,0 @@
-name: "SocialNetwork"
-autotype: graph
-tag: [general]
-
-language: zh
-
-description:
- zh: "社交网络图 - 专注于提取人际关系、互动与组织隶属"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "名称"
- - name: type
- type: "string"
- description:
- zh: "节点类型:人物、组织、机构、其他"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- - name: role
- type: "string"
- description:
- zh: "角色/身份"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源节点"
- - name: target
- type: "string"
- description:
- zh: "目标节点"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:亲属、朋友、同事、师生、上下级、合作、竞争、隶属、其他"
- - name: details
- type: "string"
- description:
- zh: "关系详细说明"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的社会关系分析专家,请从文本中提取人物、组织及其相互关系。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从提取的节点中创建边
-
- rules_for_nodes:
- zh: |
- - 提取所有人物、组织、机构等
- - 为每个节点指定类型和角色
-
- rules_for_edges:
- zh: |
- - 亲属:血缘或姻亲关系
- - 朋友:朋友关系
- - 同事:工作关系
- - 师生:教育关系
- - 上下级:层级关系
- - 合作:合作关系
- - 竞争:竞争关系
- - 隶属:组织隶属关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({role})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/industry/emergency_response_graph.yaml b/hyperextract/templates/presets/industry/emergency_response_graph.yaml
deleted file mode 100644
index 4e52d2e..0000000
--- a/hyperextract/templates/presets/industry/emergency_response_graph.yaml
+++ /dev/null
@@ -1,108 +0,0 @@
-name: "EmergencyResponseGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "应急预案图谱 - 提取事故场景、响应动作和部门,构建应急响应流程,识别应急响应的流程和责任分工"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(如:火灾、停电、报警、疏散人员、设备部等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:事故场景、响应动作、部门"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "对该实体的描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体名称(事故场景或响应动作)"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体名称(响应动作或部门)"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:触发、执行、负责"
- required: true
- default: ""
- - name: time_limit
- type: "string"
- description:
- zh: "响应时间要求(如:5分钟内、10分钟内)"
- required: false
- default: ""
- - name: success_criterion
- type: "string"
- description:
- zh: "成功标准(如:人员安全撤离、火势控制)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业应急管理分析专家,请从文本中提取事故场景、响应动作和部门,构建应急响应流程。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别事故场景(如火灾、泄漏、停电、设备故障、人员受伤等)
- 6. 识别响应动作(如报警、疏散人员、关闭电源等)
- 7. 识别负责部门(如安保部、设备部、急救部、后勤部等)
- 8. 建立从事故场景到响应动作的流程关系
- 9. 记录时间要求和成功标准
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别事故场景名称(如火灾、泄漏、停电、设备故障)
- 4. 识别响应动作名称(如报警、疏散人员、关闭电源)
- 5. 识别负责部门名称(如安保部、设备部、急救部)
- 6. 为每个实体指定类别(事故场景/响应动作/部门)
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别从事故场景到响应动作的关联
- 4. 识别从响应动作到负责部门的关联
- 5. 记录响应时间要求
- 6. 记录成功标准
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/industry/equipment_topology_graph.yaml b/hyperextract/templates/presets/industry/equipment_topology_graph.yaml
deleted file mode 100644
index 5d6321a..0000000
--- a/hyperextract/templates/presets/industry/equipment_topology_graph.yaml
+++ /dev/null
@@ -1,119 +0,0 @@
-name: "EquipmentTopologyGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "设备拓扑图谱 - 提取工业设备的实体及其相互连接关系,包括物料流向、能量传递、控制信号等"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "设备或部件名称"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:主机、辅机、部件、仪表、阀门、管路、系统、电机、泵、风机、容器等"
- required: true
- default: ""
- - name: location
- type: "string"
- description:
- zh: "安装位置(如:生产车间一层、主厂房二层)"
- required: false
- default: ""
- - name: status
- type: "string"
- description:
- zh: "运行状态:运行、备用、检修、停运"
- required: false
- default: ""
- - name: specification
- type: "string"
- description:
- zh: "规格型号或技术参数"
- required: false
- default: ""
- - name: manufacturer
- type: "string"
- description:
- zh: "制造厂家"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "上游设备或源设备名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "下游设备或目标设备名称"
- required: true
- default: ""
- - name: connectionType
- type: "string"
- description:
- zh: "连接类型:物料输送、能量传递、控制信号、工艺流程、电气连接、仪表监测等"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "连接关系的详细描述(如:高温物料流向、循环水回路、闭环控制系统)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业设备管理专家,请从文本中提取设备实体及其相互连接关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的设备,禁止将多个设备合并为一个节点
- 2. 设备名称与原文保持一致
- 3. 仅从已知设备列表中提取边,不要创建新的设备节点
- 4. 关系描述应与原文保持一致
- 5. 识别所有设备、部件和系统
- 6. 分类设备类型(主机/辅机/部件/仪表/阀门/管路/系统/电机/泵/风机/容器等)
- 7. 提取设备之间的连接关系,包括物料输送、能量传递、控制信号等
- 8. 记录安装位置和运行状态
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的设备,禁止将多个设备合并为一个节点
- 2. 设备名称与原文保持一致
- 3. 识别设备名称和部件名称
- 4. 分类设备类别(主机、辅机、部件、仪表、阀门、管路、系统、电机、泵、风机、容器等)
- 5. 记录安装位置和运行状态
- rules_for_edges:
- zh: |
- 1. 仅从已知设备列表中提取边,不要创建新的设备节点
- 2. 关系描述应与原文保持一致
- 3. 识别物料输送关系(上游→下游)
- 4. 识别能量传递关系(驱动设备→被驱动设备)
- 5. 识别控制信号关系(控制设备→被控设备)
- 6. 识别工艺流程关系(前一工序→后一工序)
- 7. 识别电气连接和仪表监测关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{connectionType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{connectionType}"
diff --git a/hyperextract/templates/presets/industry/failure_case_graph.yaml b/hyperextract/templates/presets/industry/failure_case_graph.yaml
deleted file mode 100644
index 6215f6a..0000000
--- a/hyperextract/templates/presets/industry/failure_case_graph.yaml
+++ /dev/null
@@ -1,108 +0,0 @@
-name: "FailureCaseGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "故障案例图谱 - 提取故障现象、原因、措施和教训,识别从发现到处理的完整故障演进链条"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "现象/措施等实体的名称"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:现象、原因、措施、教训"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "对该实体内涵的进一步阐述和说明"
- required: false
- default: ""
- - name: equipment
- type: "string"
- description:
- zh: "涉及设备名称"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "上游环节名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "下游环节名称"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:导致、采取、产生、发现"
- required: true
- default: ""
- - name: time_sequence
- type: "string"
- description:
- zh: "时序关系:发现、分析、处理、总结"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业设备故障分析专家,请从文本中提取故障现象、原因、处理措施和经验教训。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别故障现象和异常表现
- 6. 分析故障原因和根本原因
- 7. 提取处理措施和解决方案
- 8. 总结经验教训和改进建议
- 9. 建立从发现到处理的完整链条
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别故障现象和异常表现
- 4. 识别故障原因和根本原因
- 5. 识别处理措施和解决方案
- 6. 识别经验教训和改进建议
- 7. 记录涉及的设备名称
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别从现象到原因的关联
- 4. 识别从原因到措施的关联
- 5. 识别从措施到教训的关联
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/industry/failure_knowledge_hypergraph.yaml b/hyperextract/templates/presets/industry/failure_knowledge_hypergraph.yaml
deleted file mode 100644
index bee3814..0000000
--- a/hyperextract/templates/presets/industry/failure_knowledge_hypergraph.yaml
+++ /dev/null
@@ -1,93 +0,0 @@
-name: "FailureKnowledgeHypergraph"
-autotype: hypergraph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "故障知识超图 - 从故障案例中提取故障现象、根因、部件、解决方案的复杂关联关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(例如:振动异常、轴承损坏密封失效等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类型:故障现象、根因、部件、解决方案"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "描述(例如:表现为轴承温度升高、由于润滑不良导致)"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: nodes
- type: "array"
- description:
- zh: "参与故障推理的节点列表:[故障现象1, 故障现象2, ..., 根因, 部件, 解决方案1, 解决方案2, ...]"
- required: true
- default: ""
- - name: reasoning_type
- type: "string"
- description:
- zh: "推理类型:故障诊断、原因分析、解决方案"
- required: true
- default: ""
- - name: failure_description
- type: "string"
- description:
- zh: "故障详细描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位设备故障诊断专家,请从故障案例中提取故障知识实体和故障诊断推理作为超边。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 识别故障现象(振动异常、噪音、温度升高、泄漏、异响)
- 5. 识别故障根因(润滑不良、过载、磨损、老化、设计缺陷)
- 6. 识别故障部件(轴承、密封、电机、泵体、阀门)
- 7. 识别解决方案(更换备件、调整参数、清洁、紧固)
- 8. 建立从现象→根因→解决方案的完整推理链条
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别故障现象(振动异常、噪音、温度升高、泄漏、异响)
- 4. 识别故障根因(润滑不良、过载、磨损、老化、设计缺陷)
- 5. 识别故障部件(轴承、密封、电机、泵体、阀门)
- 6. 识别解决方案(更换备件、调整参数、清洁、紧固)
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别故障现象(振动异常、噪音、温度升高、泄漏、异响)
- 4. 识别从现象到根因的推理
- 5. 识别从根因到解决方案的推理
- 6. 边的 nodes 字段应包含所有参与该故障推理的实体
-
-identifiers:
- node_id: "name"
- edge_id: "{reasoning_type}_{nodes}"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{reasoning_type}"
diff --git a/hyperextract/templates/presets/industry/incident_causality_map.yaml b/hyperextract/templates/presets/industry/incident_causality_map.yaml
deleted file mode 100644
index bb2f861..0000000
--- a/hyperextract/templates/presets/industry/incident_causality_map.yaml
+++ /dev/null
@@ -1,102 +0,0 @@
-name: "IncidentCausalityMap"
-autotype: hypergraph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "事故因果链超图 - 从事故调查报告中提取隐患、触发条件、违章行为、事故后果的因果关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(例如:违章操作、泄漏积累、点火源等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类型:隐患、触发条件、违章行为、事故后果"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "描述(例如:未佩戴安全带、管道腐蚀破裂)"
- required: false
- default: ""
- - name: severity
- type: "string"
- description:
- zh: "严重程度:轻微、一般、严重、重大"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: nodes
- type: "array"
- description:
- zh: "参与因果链条的节点列表:[隐患1, 隐患2, ..., 触发条件, 违章行为, 事故后果1, 事故后果2, ...]"
- required: true
- default: ""
- - name: causality_type
- type: "string"
- description:
- zh: "因果类型:隐患积累、触发导致、违章促成、后果扩展"
- required: true
- default: ""
- - name: causality_description
- type: "string"
- description:
- zh: "因果关系详细描述(例如:由于管道腐蚀导致泄漏,遇火源引发火灾)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业安全事故调查专家,请从事故调查报告中提取实体和事故因果链条作为超边。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 识别隐患(设备老化、防护缺失、管理漏洞、安全培训不足)
- 5. 识别触发条件(点火源、静电、明火、高温)
- 6. 识别违章行为(违章操作、违章指挥、违反劳动纪律)
- 7. 识别事故后果(人员伤亡、设备损坏、环境污染、停产损失)
- 8. 建立完整的因果链条:隐患 → 触发条件 → 违章行为 → 事故后果
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别隐患(设备老化、防护缺失、管理漏洞、安全培训不足)
- 4. 识别触发条件(点火源、静电、明火、高温)
- 5. 识别违章行为(违章操作、违章指挥、违反劳动纪律)
- 6. 识别事故后果(人员伤亡、设备损坏、环境污染、停产损失)
- 7. 为实体指定严重程度
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别隐患积累过程
- 4. 识别触发条件的作用
- 5. 识别违章行为的促成作用
- 6. 识别事故后果的扩展
- 7. 建立完整的因果链条:隐患 → 触发条件 → 违章行为 → 事故后果
- 8. 边的 nodes 字段应包含所有参与该因果链条的实体
-
-identifiers:
- node_id: "name"
- edge_id: "{causality_type}_{nodes}"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{causality_type}"
diff --git a/hyperextract/templates/presets/industry/inspection_record_graph.yaml b/hyperextract/templates/presets/industry/inspection_record_graph.yaml
deleted file mode 100644
index 5b67fd4..0000000
--- a/hyperextract/templates/presets/industry/inspection_record_graph.yaml
+++ /dev/null
@@ -1,97 +0,0 @@
-name: "InspectionRecordGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "巡检记录图谱 - 提取设备和巡检项,构建巡检层级结构,识别设备与巡检项之间的从属关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(如:数控加工中心、机械臂系统、电机运行状态、轴承温度检查等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:设备、巡检项"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "对该实体的描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "父实体(整体/设备)名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "子实体(巡检项/部分)名称"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:属于、子类"
- required: true
- default: ""
- - name: details
- type: "string"
- description:
- zh: "关系详细说明"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业设备巡检分析专家,请从文本中提取设备和巡检项,构建巡检层级结构。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别大设备(如数控加工中心、机械臂系统、物料输送系统等)
- 6. 识别每个设备下的巡检项(如电机运行状态、轴承温度、冷却液位等)
- 7. 建立巡检项与设备之间的从属关系
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别设备名称(大类)
- 4. 识别巡检项名称(具体检查点)
- 5. 为每个实体指定类别(设备/巡检项)
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别巡检项与设备之间的从属关系
- 4. 例如:电机运行状态 属于 数控加工中心
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/industry/maintenace_operation_map.yaml b/hyperextract/templates/presets/industry/maintenace_operation_map.yaml
deleted file mode 100644
index 530f201..0000000
--- a/hyperextract/templates/presets/industry/maintenace_operation_map.yaml
+++ /dev/null
@@ -1,113 +0,0 @@
-name: "MaintenaceOperationMap"
-autotype: hypergraph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "维修作业图 - 从维修作业指导书中提取操作人、工具、对象、耗时的复杂关联关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(例如:维修工李四、扳手、离心泵P-101、润滑油等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类型:人员、工具、设备、材料、备件、岗位"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "描述或规格(例如:高级维修工、16mm开口扳手、15kW离心泵)"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: nodes
- type: "array"
- description:
- zh: "参与作业的节点列表:[操作人员, 工具1, 工具2, 设备, 材料1, ...]"
- required: true
- default: ""
- - name: operation_name
- type: "string"
- description:
- zh: "作业名称或步骤(例如:更换轴承、清洗过滤器、添加润滑油)"
- required: true
- default: ""
- - name: duration
- type: "string"
- description:
- zh: "作业耗时(例如:30分钟、2小时、半天)"
- required: false
- default: ""
- - name: prerequisite
- type: "string"
- description:
- zh: "前置条件或注意事项(例如:需停机断电、需佩戴防护用品)"
- required: false
- default: ""
- - name: quality_standard
- type: "string"
- description:
- zh: "质量标准或验收要求(例如:运转正常无异响、螺栓紧固力矩达标)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位设备维修管理专家,请从维修作业指导书中提取实体和维修作业中的复杂关联作为超边。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 识别维修人员(维修工、班组长、技术员)
- 5. 识别工具(扳手、螺丝刀、千斤顶、测量仪器)
- 6. 识别设备(离心泵、电机、阀门)
- 7. 识别材料(润滑油、密封胶、清洁剂)
- 8. 识别备件(轴承、密封圈、滤芯)
- 9. 识别维修作业步骤(更换轴承、清洗过滤器、添加润滑油)
- 10. 关联操作人员和工具
- 11. 关联设备和材料/备件
- 12. 提取作业耗时
- 13. 记录前置条件和质量标准
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别维修人员(维修工、班组长、技术员)
- 4. 识别工具(扳手、螺丝刀、千斤顶、测量仪器)
- 5. 识别设备(离心泵、电机、阀门)
- 6. 识别材料(润滑油、密封胶、清洁剂)
- 7. 识别备件(轴承、密封圈、滤芯)
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别维修作业步骤(更换轴承、清洗过滤器、添加润滑油)
- 4. 关联操作人员和工具
- 5. 关联设备和材料/备件
- 6. 提取作业耗时
- 7. 记录前置条件和质量标准
- 8. 边的 nodes 字段应包含所有参与该作业的实体
-
-identifiers:
- node_id: "name"
- edge_id: "{operation_name}_{nodes}"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{operation_name}"
diff --git a/hyperextract/templates/presets/industry/operating_mode_graph.yaml b/hyperextract/templates/presets/industry/operating_mode_graph.yaml
deleted file mode 100644
index 5d6d246..0000000
--- a/hyperextract/templates/presets/industry/operating_mode_graph.yaml
+++ /dev/null
@@ -1,113 +0,0 @@
-name: "OperatingModeGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "工况切换图谱 - 提取工况类型和切换条件,识别不同工况之间的切换条件和步骤"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(如:自动运行模式、手动调试模式、待机模式、紧急停止模式、按下启动按钮、按下停止按钮、发生故障等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:工况、条件。工况如自动运行、手动调试、待机等;条件如启动按钮、停止按钮、故障信号等"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "对该实体的描述"
- required: false
- default: ""
- - name: load_range
- type: "string"
- description:
- zh: "负荷范围(如:0-50%、50-80%、80-100%等),仅对工况类别有效"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体名称(工况或条件)"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体名称(工况或条件)"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:切换到、触发"
- required: true
- default: ""
- - name: transition_condition
- type: "string"
- description:
- zh: "切换条件(如:按下启动按钮、按下停止按钮、发生故障等)"
- required: false
- default: ""
- - name: transition_procedure
- type: "string"
- description:
- zh: "切换步骤"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业设备工况分析专家,请从文本中提取工况和条件实体,以及它们之间的关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别各种运行模式(工况),如自动运行、手动调试、待机、紧急停止等
- 6. 识别各种触发条件,如按下启动按钮、按下停止按钮、发生故障等
- 7. 识别每种工况的适用条件和负荷范围
- 8. 提取工况之间的切换关系(切换到)
- 9. 提取条件触发工况的关系(触发)
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别工况名称(如自动运行模式、手动调试模式、待机模式、紧急停止模式等)
- 4. 识别条件名称(如按下启动按钮、按下停止按钮、发生故障、恢复正常等)
- 5. 为每个实体指定类别(工况/条件)
- 6. 记录每种工况的负荷范围
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别工况之间的切换关系(源工况 切换到 目标工况)
- 4. 识别条件对工况的触发关系(条件 触发 目标工况)
- 5. 关系类型使用 切换到 或 触发
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/industry/operation_flow_graph.yaml b/hyperextract/templates/presets/industry/operation_flow_graph.yaml
deleted file mode 100644
index d34311b..0000000
--- a/hyperextract/templates/presets/industry/operation_flow_graph.yaml
+++ /dev/null
@@ -1,119 +0,0 @@
-name: "OperationFlowGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "操作流程图谱 - 提取操作步骤、设备状态和预期结果,识别操作流程中的步骤顺序和状态变化"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "操作步骤名称(如:开启辅助电源、启动液压系统、检查状态、关闭主电源等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:动作、设备状态。动作如开启、关闭、检查等;设备状态如运行中、待机、停止等"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "对该操作步骤的详细描述"
- required: false
- default: ""
- - name: expected_result
- type: "string"
- description:
- zh: "执行该步骤后的预期结果"
- required: false
- default: ""
- - name: target_equipment
- type: "string"
- description:
- zh: "涉及的目标设备名称"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "当前步骤名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "下一步骤名称"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:下一步、触发、导致"
- required: true
- default: ""
- - name: trigger_condition
- type: "string"
- description:
- zh: "触发下一步骤的条件"
- required: false
- default: ""
- - name: state_change
- type: "string"
- description:
- zh: "状态变化描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业操作流程分析专家,请从文本中提取操作步骤、设备状态和预期结果。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别各个操作步骤和执行顺序(如:开启辅助电源 → 启动液压系统 → 启动控制系统)
- 6. 识别设备状态变化(如:从待机状态切换到运行状态)
- 7. 记录每一步骤的详细操作内容、预期结果和涉及设备
- 8. 建立步骤之间的流转关系
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别操作步骤名称(如开启辅助电源、启动液压系统、检查状态、关闭主电源等)
- 4. 识别设备状态名称(如运行中、待机、停止、故障等)
- 5. 为每个实体指定类别(动作/设备状态)
- 6. 记录每一步骤的预期结果和涉及设备
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别步骤的执行顺序(当前步骤 → 下一步骤)
- 4. 提取触发下一步骤的条件
- 5. 记录设备状态的变化
- 6. 关系类型使用:下一步、触发、导致
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/industry/part_replacement_list.yaml b/hyperextract/templates/presets/industry/part_replacement_list.yaml
deleted file mode 100644
index 5177522..0000000
--- a/hyperextract/templates/presets/industry/part_replacement_list.yaml
+++ /dev/null
@@ -1,70 +0,0 @@
-name: "PartReplacementList"
-autotype: list
-tag: [industry]
-
-language: zh
-
-description:
- zh: "备件消耗清单 - 从设备维护记录中提取零件型号、数量、更换原因"
-
-item_schema:
- fields:
- - name: part_name
- type: "string"
- description:
- zh: "备件名称(例如:轴承、密封圈、滤芯、润滑油、刀片等)"
- required: true
- default: ""
- - name: part_number
- type: "string"
- description:
- zh: "备件型号或编号(例如:SKF-6205、GB/T1234-2010)"
- required: false
- default: ""
- - name: quantity
- type: "string"
- description:
- zh: "更换数量(例如:2件、5升、1套)"
- required: false
- default: ""
- - name: unit
- type: "string"
- description:
- zh: "计量单位(例如:件、个、套、升、公斤)"
- required: false
- default: ""
- - name: replacement_reason
- type: "string"
- description:
- zh: "更换原因(例如:磨损、老化、损坏、预防性更换)"
- required: false
- default: ""
- - name: equipment_name
- type: "string"
- description:
- zh: "所属设备名称(例如:离心泵P-101、空压机C-001)"
- required: false
- default: ""
- - name: maintenance_type
- type: "string"
- description:
- zh: "维护类型:例行保养、故障维修、计划检修、抢修"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位设备维护管理专家,请从备件更换记录中提取所有备件消耗条目。
- rules:
- zh: |
- 1. 每个条目对应一个独立的备件,禁止合并
- 2. 备件名称和型号与原文保持一致
- 3. 提取备件名称、型号、编号
- 4. 提取更换数量和计量单位
- 5. 提取更换原因(磨损、老化、损坏、预防性更换等)
- 6. 提取所属设备名称
- 7. 识别维护类型(例行保养、故障维修、计划检修、抢修)
-
-display:
- label: "{part_name} x{quantity} ({replacement_reason})"
diff --git a/hyperextract/templates/presets/industry/safety_control_graph.yaml b/hyperextract/templates/presets/industry/safety_control_graph.yaml
deleted file mode 100644
index a13c028..0000000
--- a/hyperextract/templates/presets/industry/safety_control_graph.yaml
+++ /dev/null
@@ -1,118 +0,0 @@
-name: "SafetyControlGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "安全管控图谱 - 提取危险源、风险点和管控措施,构建安全管控关系,识别安全风险与管控责任的对应关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(如:数控加工中心、烫伤风险、佩戴防护用品、安全主管等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:危险源、风险点、管控措施、责任人"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "对该实体的描述"
- required: false
- default: ""
- - name: risk_level
- type: "string"
- description:
- zh: "风险等级:重大风险、较大风险、一般风险,仅对风险点类别有效"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体名称(危险源或风险点或管控措施)"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体名称(风险点或管控措施或责任人)"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:导致、需要、管控、负责"
- required: true
- default: ""
- - name: hazard_factor
- type: "string"
- description:
- zh: "危险因素(如:高温部件、旋转部件、高压液体等)"
- required: false
- default: ""
- - name: possible_consequence
- type: "string"
- description:
- zh: "可能导致后果(如:烫伤、机械伤害、触电等)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业安全管理分析专家,请从文本中提取危险源、风险点和管控措施,构建安全管控关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别危险源(如数控加工中心、工业机械臂、冷却系统、液压站、电气控制柜等)
- 6. 识别风险点(如烫伤风险、机械伤害风险、触电风险、摔伤风险等)
- 7. 识别管控措施(如佩戴防护用品、设置安全围栏、定期检修、通风换气等)
- 8. 识别责任人(如安全主管、设备负责人、班组长、电工等)
- 9. 为风险点指定风险等级(重大风险、较大风险、一般风险)
- 10. 建立从危险源→风险点→管控措施→责任人的完整管控链条
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别危险源名称(如数控加工中心、工业机械臂、冷却系统、液压站、电气控制柜等)
- 4. 识别风险点名称(如烫伤风险、机械伤害风险、触电风险、摔伤风险等)
- 5. 识别管控措施名称(如佩戴防护用品、设置安全围栏、定期检修、通风换气等)
- 6. 识别责任人名称(如安全主管、设备负责人、班组长、电工等)
- 7. 为每个实体指定类别(危险源/风险点/管控措施/责任人)
- 8. 为风险点指定风险等级(重大风险、较大风险、一般风险)
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别从危险源到风险点的关联(关系类型:导致)
- 4. 识别从风险点到管控措施的关联(关系类型:需要/管控)
- 5. 识别从管控措施到责任人的关联(关系类型:负责)
- 6. 记录危险因素和可能导致后果
- 7. 关系类型使用:导致、需要、管控、负责
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/industry/safety_timeline.yaml b/hyperextract/templates/presets/industry/safety_timeline.yaml
deleted file mode 100644
index caf9e4e..0000000
--- a/hyperextract/templates/presets/industry/safety_timeline.yaml
+++ /dev/null
@@ -1,122 +0,0 @@
-name: "SafetyTimeline"
-autotype: temporal_graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "事故时序图 - 从事故调查报告中提取时间线,还原事故发生前后的操作与响应序列"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称"
- required: true
- default: ""
- - name: entity_type
- type: "string"
- description:
- zh: "类型:人员、设备、设施等"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体名称"
- required: true
- default: ""
- - name: action
- type: "string"
- description:
- zh: "操作动作"
- required: true
- default: ""
- - name: timestamp
- type: "string"
- description:
- zh: "动作发生时间"
- required: false
- default: ""
- - name: location
- type: "string"
- description:
- zh: "发生位置"
- required: false
- default: ""
- - name: status
- type: "string"
- description:
- zh: "状态描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业安全事故调查专家,请从事故调查报告中提取时间线,还原事故发生前后的操作与响应序列。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别事故相关人员(操作工、班组长、安全员、管理人员)
- 6. 识别相关设备(泵、电机、阀门、仪表)
- 7. 识别操作动作(启动、停止、巡检、维修、发现异常)
- 8. 识别环境状态(正常、异常、报警、危险)
- rules_for_nodes:
- zh: |
- 1. 每个节点对应一个独立实体
- 2. 实体名称与原文保持一致
- 3. 人员、设备、设施、岗位、位置等
- rules_for_edges:
- zh: |
- 1. source 和 target 都必须是已知实体列表中的节点
- 2. 每个操作动作都必须提取为一条边
- 3. 节点名称必须完全匹配
- 4. 操作类型:启动、停止、开启、关闭、巡检、检查、排查、维修、检修、保养、发现、识别、报告、操作、使用、触发
- rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期):
- - "事故前30分钟" → {observation_time} 前30分钟
- - "当天上午" → {observation_time} 当天上午
- - "随后" → 接续前一事件
-
- 2. 精确时间 → 保持原样
- 3. 时间缺失 → 留空,不要猜测
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{action}|{target}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "timestamp"
-
-options:
- extraction_mode: "two_stage"
- # observation_time 和 observation_location 由用户在运行时提供
- # 示例:TemplateFactory.create(config, llm, embedder, observation_time="2024-06-15")
-
-display:
- node_label: "{name} ({entity_type})"
- edge_label: "{action} [{timestamp}]"
diff --git a/hyperextract/templates/presets/industry/spec_parameter_table.yaml b/hyperextract/templates/presets/industry/spec_parameter_table.yaml
deleted file mode 100644
index f414c4a..0000000
--- a/hyperextract/templates/presets/industry/spec_parameter_table.yaml
+++ /dev/null
@@ -1,143 +0,0 @@
-name: "SpecParameterTable"
-autotype: model
-tag: [industry]
-
-language: zh
-
-description:
- zh: "核心规格表 - 从技术规格书中提取额定功率、材质、尺寸精度等关键技术指标"
-
-schema:
- fields:
- - name: equipment_name
- type: "string"
- description:
- zh: "设备或产品名称(例如:数控加工中心、离心泵、变压器等)"
- required: true
- default: ""
- - name: model_number
- type: "string"
- description:
- zh: "型号或规格代号"
- required: false
- default: ""
- - name: manufacturer
- type: "string"
- description:
- zh: "制造商或供应商"
- required: false
- default: ""
- - name: rated_power
- type: "string"
- description:
- zh: "额定功率(例如:55kW、200kVA、15kW/20kW)"
- required: false
- default: ""
- - name: rated_voltage
- type: "string"
- description:
- zh: "额定电压(例如:380V、10kV、220V)"
- required: false
- default: ""
- - name: rated_current
- type: "string"
- description:
- zh: "额定电流(例如:100A、50Hz)"
- required: false
- default: ""
- - name: frequency
- type: "string"
- description:
- zh: "工作频率(例如:50Hz、60Hz)"
- required: false
- default: ""
- - name: material
- type: "string"
- description:
- zh: "主要材质或材料(例如:不锈钢304、铸铁、铝合金)"
- required: false
- default: ""
- - name: dimensions
- type: "string"
- description:
- zh: "外形尺寸或安装尺寸(例如:2000×1500×1800mm)"
- required: false
- default: ""
- - name: weight
- type: "string"
- description:
- zh: "重量或质量(例如:2500kg、5.8t)"
- required: false
- default: ""
- - name: accuracy
- type: "string"
- description:
- zh: "精度等级或精度指标(例如:±0.01mm、IT7级)"
- required: false
- default: ""
- - name: temperature_range
- type: "string"
- description:
- zh: "工作温度范围(例如:-20℃~50℃、0~80℃)"
- required: false
- default: ""
- - name: pressure_range
- type: "string"
- description:
- zh: "工作压力范围(例如:0~1.6MPa、PN16)"
- required: false
- default: ""
- - name: flow_rate
- type: "string"
- description:
- zh: "流量参数(例如:100m³/h、50L/min)"
- required: false
- default: ""
- - name: speed
- type: "string"
- description:
- zh: "转速或速度(例如:1450rpm、0.5~2m/s)"
- required: false
- default: ""
- - name: capacity
- type: "string"
- description:
- zh: "容量或处理能力(例如:500L、10m³/h)"
- required: false
- default: ""
- - name: protection_level
- type: "string"
- description:
- zh: "防护等级(例如:IP65、IP55)"
- required: false
- default: ""
- - name: insulation_class
- type: "string"
- description:
- zh: "绝缘等级(例如:F级、H级)"
- required: false
- default: ""
- - name: other_parameters
- type: "array"
- description:
- zh: "其他关键技术参数列表(如适用)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业设备技术专家,请从技术规格书中提取所有关键技术参数。
- rules:
- zh: |
- 1. 每个对象对应一个独立的设备或产品,禁止合并
- 2. 参数值与原文保持一致
- 3. 提取设备名称、型号、制造商
- 4. 提取电气参数:额定功率、额定电压、额定电流、频率
- 5. 提取物理参数:材质、尺寸、重量、精度
- 6. 提取工况参数:温度范围、压力范围、流量、转速
- 7. 提取性能参数:容量、防护等级、绝缘等级
- 8. 保留原始单位,不要换算
-
-display:
- label: "{equipment_name} ({model_number})"
diff --git a/hyperextract/templates/presets/industry/system_compatibility_graph.yaml b/hyperextract/templates/presets/industry/system_compatibility_graph.yaml
deleted file mode 100644
index a4d42df..0000000
--- a/hyperextract/templates/presets/industry/system_compatibility_graph.yaml
+++ /dev/null
@@ -1,96 +0,0 @@
-name: "SystemCompatibilityGraph"
-autotype: hypergraph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "系统兼容性超图 - 从技术规格书中提取设备与环境、介质的对应关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(例如:离心泵P-101、不锈钢304、高温环境等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类型:设备、材质、介质、环境、连接方式"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "描述(例如:15kW离心泵、适用于清水、适用于常温)"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: nodes
- type: "array"
- description:
- zh: "参与兼容性关系的节点列表:[设备, 材质/介质/环境1, 材质/介质/环境2, ...]"
- required: true
- default: ""
- - name: compatibility_type
- type: "string"
- description:
- zh: "兼容性类型:材质兼容、介质适用、环境适用、连接匹配"
- required: true
- default: ""
- - name: compatibility_note
- type: "string"
- description:
- zh: "兼容性说明或限制条件(例如:需加装过滤器、建议使用O型圈)"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业设备选型专家,请从技术规格书中提取实体和设备与环境、介质的兼容性关系作为超边。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 识别设备(离心泵、压缩机、阀门、换热器)
- 5. 识别材质(不锈钢304、铸铁、铝合金、碳钢)
- 6. 识别介质(清水、污水、油品、酸碱溶液)
- 7. 识别环境(高温环境、低温环境、防爆区域、腐蚀性环境)
- 8. 识别连接方式(法兰连接、螺纹连接、焊接)
- 9. 建立设备与材质、介质、环境的兼容性关系
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别设备(离心泵、压缩机、阀门、换热器)
- 4. 识别材质(不锈钢304、铸铁、铝合金、碳钢)
- 5. 识别介质(清水、污水、油品、酸碱溶液)
- 6. 识别环境(高温环境、低温环境、防爆区域、腐蚀性环境)
- 7. 识别连接方式(法兰连接、螺纹连接、焊接)
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别设备与材质的兼容性(不锈钢泵适用于清水)
- 4. 识别设备与介质的适用性(化工泵适用于酸碱溶液)
- 5. 识别设备对环境的要求(防爆电机适用于防爆区域)
- 6. 识别连接方式的匹配
- 7. 边的 nodes 字段应包含所有参与该兼容性关系的实体
-
-identifiers:
- node_id: "name"
- edge_id: "{compatibility_type}_{nodes}"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{compatibility_type}"
diff --git a/hyperextract/templates/presets/industry/system_topology_graph.yaml b/hyperextract/templates/presets/industry/system_topology_graph.yaml
deleted file mode 100644
index 224368f..0000000
--- a/hyperextract/templates/presets/industry/system_topology_graph.yaml
+++ /dev/null
@@ -1,102 +0,0 @@
-name: "SystemTopologyGraph"
-autotype: graph
-tag: [industry]
-
-language: zh
-
-description:
- zh: "系统拓扑图谱 - 提取工厂的厂区、系统、子系统、设备等层级结构"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称(如:A工厂、制造车间A、数控加工系统、冷却系统等)"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "类别:厂区、系统、子系统、设备"
- required: true
- default: ""
- - name: function
- type: "string"
- description:
- zh: "功能描述"
- required: false
- default: ""
- - name: capacity
- type: "string"
- description:
- zh: "容量或规模"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "上级实体名称(厂区或系统)"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "下级实体名称(系统或子系统或设备)"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:包含等"
- required: true
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位工业系统架构分析专家,请从文本中提取实体和它们之间的层级关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 识别厂区(如A工厂、B工厂)
- 6. 识别生产系统(如制造车间、加工车间)
- 7. 识别子系统(如数控加工系统、冷却系统)
- 8. 识别具体设备(如数控加工中心、机械臂、泵等)
- 9. 建立上下级的层级包含关系
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 识别厂区名称(如A工厂、B工厂)
- 4. 识别生产系统名称(如制造车间、加工车间)
- 5. 识别子系统名称(如数控加工系统、冷却系统)
- 6. 识别具体设备名称(如数控加工中心、机械臂、泵等)
- 7. 为每个实体指定类别(厂区/系统/子系统/设备)
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 识别厂区与系统之间的包含关系
- 4. 识别系统与子系统之间的包含关系
- 5. 识别子系统与设备之间的包含关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/legal/adjudication_logic.yaml b/hyperextract/templates/presets/legal/adjudication_logic.yaml
index cab36c9..2a281ac 100644
--- a/hyperextract/templates/presets/legal/adjudication_logic.yaml
+++ b/hyperextract/templates/presets/legal/adjudication_logic.yaml
@@ -1,101 +1,105 @@
-name: "AdjudicationLogic"
-autotype: hypergraph
-tag: [legal]
-
language: zh
-
+name: AdjudicationLogic
+type: hypergraph
+tags:
+- legal
description:
- zh: "裁判逻辑超图 - 建模法官的推理过程"
+ zh: '裁判逻辑超图 - 建模法官的推理过程'
-node_schema:
- fields:
+output:
+ description:
+ zh: '包含裁判要素和推理逻辑的超图结构'
+ entities:
+ description:
+ zh: '提取的裁判要素列表'
+ fields:
- name: name
- type: "string"
+ type: string
description:
- zh: "要素名称"
+ zh: '要素名称'
required: true
- default: ""
+ default: ''
- name: category
- type: "string"
+ type: string
description:
- zh: "要素类型:事实认定、法律依据、裁判结论、主旨、证据、其他"
+ zh: '要素类型:事实认定、法律依据、裁判结论、主旨、证据、其他'
required: true
- default: ""
+ default: ''
- name: description
- type: "string"
+ type: string
description:
- zh: "简要描述"
+ zh: '简要描述'
required: false
- default: ""
-
-edge_schema:
- fields:
+ default: ''
+ relations:
+ description:
+ zh: '提取的推理逻辑关系列表'
+ fields:
- name: logic_type
- type: "string"
+ type: string
description:
- zh: "推理类型:事实认定、法律适用、因果认定、责任认定、金额计算、其他"
+ zh: '推理类型:事实认定、法律适用、因果认定、责任认定、金额计算、其他'
required: true
- default: ""
+ default: ''
- name: participants
- type: "array"
+ type: array
description:
- zh: "参与要素名称列表,必须使用已提取节点的 name"
+ zh: '参与要素名称列表,必须使用已提取节点的 name'
required: true
- default: ""
+ default: ''
- name: reasoning
- type: "string"
+ type: string
description:
- zh: "推理过程描述,从事实到结论的逻辑推导"
+ zh: '推理过程描述,从事实到结论的逻辑推导'
required: true
- default: ""
+ default: ''
- name: conclusion
- type: "string"
+ type: string
description:
- zh: "推理结论"
+ zh: '推理结论'
required: false
- default: ""
+ default: ''
- name: source_clause
- type: "string"
+ type: string
description:
- zh: "裁判文书的章节位置"
+ zh: '裁判文书的章节位置'
required: false
- default: ""
+ default: ''
-guide:
+guideline:
target:
- zh: |
- 你是一位专业的法律工作者,请从裁判文书中提取裁判要素和裁判逻辑。
+ zh: '你是一位专业的法律工作者,请从裁判文书中提取裁判要素和裁判逻辑。'
rules:
- zh: |
- 1. 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
- 2. 要素名称与原文保持一致
- 3. 仅从已提取节点中提取边,不要创建新名称
- 4. 超边必须包含 logic_type, participants, reasoning
- 5. participants 应包含涉及的事实认定、法律依据、裁判结论等要素
- 6. 要素类型:事实认定(法院认定的案件事实)、法律依据(适用的法律条文、司法解释等)、裁判结论(判决结果或裁定结果)、主旨(裁判的核心观点或要旨)、证据(用于证明事实的证据材料)、其他(不属于上述类别的要素)
- 7. 推理类型:事实认定(从证据推导出事实)、法律适用(将法律适用于事实)、因果认定(认定行为与结果之间的因果关系)、责任认定(认定责任主体和责任大小)、金额计算(计算赔偿金额或标的金额)、其他(不属于上述类别的推理)
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
- 2. 要素名称与原文保持一致
- 3. 提取裁判文书中涉及的要素作为节点
- 4. 为每个要素指定类型
- 5. 为每个要素添加简要描述(1-2句话)
- rules_for_edges:
- zh: |
- 1. participants 必须严格使用已知裁判要素列表中的名称,不要创建新名称
- 2. 超边必须包含 logic_type, participants, reasoning
- 3. participants 应包含涉及的事实认定、法律依据、裁判结论等要素
- 4. reasoning 描述从事实到结论的逻辑推导过程
+ zh:
+ - '每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点'
+ - '要素名称与原文保持一致'
+ - '仅从已提取节点中提取边,不要创建新名称'
+ - '超边必须包含 logic_type, participants, reasoning'
+ - 'participants 应包含涉及的事实认定、法律依据、裁判结论等要素'
+ - '要素类型:事实认定(法院认定的案件事实)、法律依据(适用的法律条文、司法解释等)、裁判结论(判决结果或裁定结果)、主旨(裁判的核心观点或要旨)、证据(用于证明事实的证据材料)、其他(不属于上述类别的要素)'
+ - '推理类型:事实认定(从证据推导出事实)、法律适用(将法律适用于事实)、因果认定(认定行为与结果之间的因果关系)、责任认定(认定责任主体和责任大小)、金额计算(计算赔偿金额或标的金额)、其他(不属于上述类别的推理)'
+ rules_for_entities:
+ zh:
+ - '每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点'
+ - '要素名称与原文保持一致'
+ - '提取裁判文书中涉及的要素作为节点'
+ - '为每个要素指定类型'
+ - '为每个要素添加简要描述(1-2句话)'
+ rules_for_relations:
+ zh:
+ - 'participants 必须严格使用已知裁判要素列表中的名称,不要创建新名称'
+ - '超边必须包含 logic_type, participants, reasoning'
+ - 'participants 应包含涉及的事实认定、法律依据、裁判结论等要素'
+ - 'reasoning 描述从事实到结论的逻辑推导过程'
identifiers:
- node_id: "name"
- edge_id: "{logic_type}_{participants}"
- edge_members: "participants"
+ entity_id: name
+ relation_id: '{logic_type}_{participants}'
+ relation_members: participants
options:
- extraction_mode: "two_stage"
+ extraction_mode: two_stage
display:
- node_label: "{name} ({category})"
- edge_label: "[{logic_type}] {conclusion}"
+ entity_label: '{name} ({category})'
+ relation_label: '[{logic_type}] {conclusion}'
diff --git a/hyperextract/templates/presets/legal/beneficial_ownership_graph.yaml b/hyperextract/templates/presets/legal/beneficial_ownership_graph.yaml
deleted file mode 100644
index 32d1ef9..0000000
--- a/hyperextract/templates/presets/legal/beneficial_ownership_graph.yaml
+++ /dev/null
@@ -1,107 +0,0 @@
-name: "BeneficialOwnershipGraph"
-autotype: graph
-tag: [legal]
-
-language: zh
-
-description:
- zh: "受益所有权图谱 - 穿透多层股权结构,识别最终受益人和控制人"
-
-node_schema:
- fields:
- - name: entity_name
- type: "string"
- description:
- zh: "实体名称,如公司名、人名"
- required: true
- default: ""
- - name: entity_type
- type: "string"
- description:
- zh: "实体类型:公司、自然人、基金、合伙企业、境外特殊目的公司"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述,如持股比例、职务"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体名称"
- required: true
- default: ""
- - name: relation_type
- type: "string"
- description:
- zh: "关系类型:控股、参股、担任董事、执行事务合伙人、实际控制、配偶关系等"
- required: true
- default: ""
- - name: shareholding_ratio
- type: "string"
- description:
- zh: "持股比例或出资比例,如35%、1%、XX%"
- required: false
- default: ""
- - name: description
- type: "string"
- description:
- zh: "关系描述,如通过多层持股结构控制"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的反洗钱合规专员,请从文本中提取股权结构和受益所有权信息。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 实体类型:公司、自然人、基金、合伙企业、境外特殊目的公司
- 6. 包含股东、合伙人、高管、实际控制人等
- 7. 关系类型:控股(持有50%以上股份或出资额)、参股(持有一定比例股份但不构成控股)、担任董事(在公司担任董事职务)、执行事务合伙人(执行合伙事务)、实际控制(通过协议或其他安排实现实际控制)、配偶关系(夫妻关系)、其他关系(如父子、兄弟、姐妹等)
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 实体类型:公司、自然人、基金、合伙企业、境外特殊目的公司
- 4. 包含股东、合伙人、高管、实际控制人等
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 控股:持有50%以上股份或出资额
- 4. 参股:持有一定比例股份但不构成控股
- 5. 担任董事:在公司担任董事职务
- 6. 执行事务合伙人:执行合伙事务
- 7. 实际控制:通过协议或其他安排实现实际控制
- 8. 配偶关系:夫妻关系
- 9. 其他关系:如父子、兄弟、姐妹等
-
-identifiers:
- node_id: "entity_name"
- edge_id: "{source}|{relation_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{entity_name}({entity_type})"
- edge_label: "{relation_type} {shareholding_ratio}"
diff --git a/hyperextract/templates/presets/legal/case_fact_timeline.yaml b/hyperextract/templates/presets/legal/case_fact_timeline.yaml
deleted file mode 100644
index a6a5f71..0000000
--- a/hyperextract/templates/presets/legal/case_fact_timeline.yaml
+++ /dev/null
@@ -1,114 +0,0 @@
-name: "CaseFactTimeline"
-autotype: temporal_graph
-tag: [legal]
-
-language: zh
-
-description:
- zh: "案件事实时序图 - 展示法律关系的变化过程"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如原告、被告、合同、金钱、股权等"
- required: true
- default: ""
- - name: entity_type
- type: "string"
- description:
- zh: "实体类型:当事人、合同/协议、金钱、股权、证物、其他"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体名称"
- required: true
- default: ""
- - name: event
- type: "string"
- description:
- zh: "法律行为或事件,如签订协议、支付投资款、分配红利、提起诉讼等"
- required: true
- default: ""
- - name: time_info
- type: "string"
- description:
- zh: "时间信息,统一格式为年-月-日(如2021-03-15)或年月(如2021-03)"
- required: false
- default: ""
- - name: description
- type: "string"
- description:
- zh: "事件详细描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的法律工作者,请从文本中提取案件相关的法律实体以及它们之间的法律行为。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 实体类型:当事人(原告、被告、第三人、法定代表人、委托诉讼代理人)、合同/协议(战略合作协议、补充协议、收益分配说明函等)、金钱(投资款、红利、违约金等)、股权(股份、股权等)
- 6. 法律行为:签订协议、支付投资款、完成登记、召开股东会、分配红利、发送函件、提起诉讼等
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 实体类型:当事人、合同/协议、金钱、股权、证物、其他
- 4. 当事人:原告、被告、第三人、法定代表人、委托诉讼代理人
- 5. 合同/协议:战略合作协议、补充协议、收益分配说明函等
- 6. 金钱:投资款、红利、违约金等
- 7. 股权:股份、股权等
- rules_for_edges:
- zh: |
- 1. 仅从已知法律实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 常见的法律行为:签订协议、支付投资款、完成登记、召开股东会、分配红利、发送函件、提起诉讼等
- 4. 每个边表示一个法律行为,连接相关实体
- rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期)
- 2. 精确时间 → 转换为标准格式年-月-日
- 3. 时间缺失 → 留空
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{event}|{target}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "time_info"
-
-options:
- extraction_mode: "two_stage"
- # observation_time 和 observation_location 由用户在运行时提供
- # 示例:TemplateFactory.create(config, llm, embedder, observation_time="2024-06-15")
-
-display:
- node_label: "{name}({entity_type})"
- edge_label: "{event} [{time_info}]"
diff --git a/hyperextract/templates/presets/legal/case_law_citation_net.yaml b/hyperextract/templates/presets/legal/case_law_citation_net.yaml
deleted file mode 100644
index 1f38386..0000000
--- a/hyperextract/templates/presets/legal/case_law_citation_net.yaml
+++ /dev/null
@@ -1,106 +0,0 @@
-name: "CaseLawCitationNet"
-autotype: graph
-tag: [legal]
-
-language: zh
-
-description:
- zh: "判例引用网络 - 映射案件之间的引用、先例区分或先例推翻关系"
-
-node_schema:
- fields:
- - name: case_name
- type: "string"
- description:
- zh: "判例名称,如指导案例140号、(2020)最高法民终字第XX号"
- required: true
- default: ""
- - name: case_type
- type: "string"
- description:
- zh: "案件类型:指导案例、公报案例、普通案例、司法解释、法律条文"
- required: true
- default: ""
- - name: court
- type: "string"
- description:
- zh: "审理法院"
- required: false
- default: ""
- - name: description
- type: "string"
- description:
- zh: "案件简要描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源判例名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标判例名称"
- required: true
- default: ""
- - name: citation_type
- type: "string"
- description:
- zh: "引用类型:引用、依据、先例区分、先例推翻、参考、类案"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "引用关系描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的法学专家,请从文本中提取所有判例以及它们之间的引用或关联关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的判例,禁止将多个判例合并为一个节点
- 2. 判例名称与原文保持一致
- 3. 仅从已知判例列表中提取边,不要创建未列出的判例
- 4. 关系描述应与原文保持一致
- 5. 案件类型:指导案例、公报案例、普通案例、司法解释、法律条文
- 6. 常见表达:"根据《民法典》第X条"、"指导案例XX号"、"本案确立了..."
- 7. 关系类型:引用(后案引用前案作为裁判依据)、依据(后案以前案确立的规则为法律依据)、先例区分(后案认为前案与本案情形不同,不适用前案规则)、先例推翻(后案推翻前案确立的规则)、参考(后案参考前案的裁判思路)、类案(后案与前案属于同类案件)
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的判例,禁止将多个判例合并为一个节点
- 2. 判例名称与原文保持一致
- 3. 案件类型:指导案例、公报案例、普通案例、司法解释、法律条文
- 4. 常见表达:"根据《民法典》第X条"、"指导案例XX号"、"本案确立了..."
- rules_for_edges:
- zh: |
- 1. 仅从已知判例列表中提取边,不要创建未列出的判例
- 2. 关系描述应与原文保持一致
- 3. 引用:后案引用前案作为裁判依据
- 4. 依据:后案以前案确立的规则为法律依据
- 5. 先例区分:后案认为前案与本案情形不同,不适用前案规则
- 6. 先例推翻:后案推翻前案确立的规则
- 7. 参考:后案参考前案的裁判思路
- 8. 类案:后案与前案属于同类案件
-
-identifiers:
- node_id: "case_name"
- edge_id: "{source}|{citation_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{case_name}({case_type})"
- edge_label: "{citation_type}"
diff --git a/hyperextract/templates/presets/legal/compliance_requirement_list.yaml b/hyperextract/templates/presets/legal/compliance_requirement_list.yaml
deleted file mode 100644
index d56cc99..0000000
--- a/hyperextract/templates/presets/legal/compliance_requirement_list.yaml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: "ComplianceRequirementList"
-autotype: list
-tag: [legal]
-
-language: zh
-
-description:
- zh: "合规要求清单 - 从法规或政策文件中提取合规义务"
-
-item_schema:
- fields:
- - name: requirement_type
- type: "string"
- description:
- zh: "要求类型:许可要求、报告要求、披露要求、禁止性规定、程序性要求、其他"
- required: true
- default: ""
- - name: requirement_title
- type: "string"
- description:
- zh: "要求标题或简要名称"
- required: true
- default: ""
- - name: content
- type: "string"
- description:
- zh: "要求的具体内容"
- required: true
- default: ""
- - name: responsible_entity
- type: "string"
- description:
- zh: "责任主体或适用对象"
- required: false
- default: ""
- - name: deadline
- type: "string"
- description:
- zh: "履行期限或截止日期"
- required: false
- default: ""
- - name: penalty
- type: "string"
- description:
- zh: "违规后果或处罚措施"
- required: false
- default: ""
- - name: source_clause
- type: "string"
- description:
- zh: "来源条款编号或章节"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的合规顾问,请从法规或政策文件中提取所有合规义务。
- rules:
- zh: |
- 1. 提取文本中所有合规要求或义务
- 2. 为每一项要求指定类型:许可要求、报告要求、披露要求、禁止性规定、程序性要求、其他
- 3. 记录要求的具体内容、责任主体、履行期限
- 4. 记录违规后果或处罚措施
- 5. 记录来源条款编号
- 6. 每项合规要求作为独立条目提取
- 7. 保持要求内容与原文一致
- 8. 不要遗漏任何合规要求
-
-display:
- label: "[{requirement_type}] {requirement_title}"
diff --git a/hyperextract/templates/presets/legal/contract_obligation_hypergraph.yaml b/hyperextract/templates/presets/legal/contract_obligation_hypergraph.yaml
deleted file mode 100644
index 442099d..0000000
--- a/hyperextract/templates/presets/legal/contract_obligation_hypergraph.yaml
+++ /dev/null
@@ -1,107 +0,0 @@
-name: "ContractObligationHypergraph"
-autotype: hypergraph
-tag: [legal]
-
-language: zh
-
-description:
- zh: "合同义务超图 - 建模复杂的条件性义务"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "要素名称,文本中出现的精确名称"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "要素类型:主体、义务、触发条件、例外情形、违约责任、其他"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: obligation_type
- type: "string"
- description:
- zh: "义务类型:支付义务、交付义务、保密义务、竞业限制、售后服务、其他"
- required: true
- default: ""
- - name: participants
- type: "array"
- description:
- zh: "参与要素名称列表,必须使用已提取节点的 name"
- required: true
- default: ""
- - name: trigger_condition
- type: "string"
- description:
- zh: "触发条件,如合同签订后、验收合格后、违约发生时等"
- required: false
- default: ""
- - name: exception
- type: "string"
- description:
- zh: "例外情形,如不可抗力、对方违约在先等"
- required: false
- default: ""
- - name: liability
- type: "string"
- description:
- zh: "违约责任,如支付违约金、赔偿损失、解除合同等"
- required: false
- default: ""
- - name: source_clause
- type: "string"
- description:
- zh: "义务来源条款编号或名称"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的合同法律师,请从文本中提取合同要素和合同义务。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
- 2. 要素名称与原文保持一致
- 3. 仅从已提取节点中提取边,不要创建新名称
- 4. 超边必须包含 obligation_type, participants
- 5. participants 应包含涉及的主体、义务及相关要素
- 6. 要素类型:主体(合同的当事人)、义务(具体需要执行的行为)、触发条件(义务生效或履行的前提条件)、例外情形(义务免除或减轻的情形)、违约责任(违反义务的后果)、其他(不属于上述类别的要素)
- 7. 义务类型:支付义务、交付义务、保密义务、竞业限制、售后服务、其他
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的要素,禁止将多个要素合并为一个节点
- 2. 要素名称与原文保持一致
- 3. 提取合同中涉及的要素作为节点
- 4. 为每个要素指定类型
- 5. 为每个要素添加简要描述(1-2句话)
- rules_for_edges:
- zh: |
- 1. participants 必须严格使用已知合同要素列表中的名称,不要创建新名称
- 2. 超边必须包含 obligation_type, participants
- 3. participants 应包含涉及的主体、义务及相关要素
- 4. 义务类型:支付义务、交付义务、保密义务、竞业限制、售后服务、其他
-
-identifiers:
- node_id: "name"
- edge_id: "{obligation_type}_{participants}"
- edge_members: "participants"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{obligation_type}"
diff --git a/hyperextract/templates/presets/legal/defined_term_registry.yaml b/hyperextract/templates/presets/legal/defined_term_registry.yaml
deleted file mode 100644
index edc6f74..0000000
--- a/hyperextract/templates/presets/legal/defined_term_registry.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-name: "DefinedTermRegistry"
-autotype: set
-tag: [legal]
-
-language: zh
-
-description:
- zh: "术语定义表 - 去重并汇总合同中定义的所有专有名词"
-
-item_schema:
- fields:
- - name: term
- type: "string"
- description:
- zh: "术语名称,如机密信息、不可抗力、项目"
- required: true
- default: ""
- - name: definition
- type: "string"
- description:
- zh: "术语的定义说明"
- required: true
- default: ""
- - name: source_clause
- type: "string"
- description:
- zh: "定义来源的条款编号"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的合同法律师,请从文本中提取所有定义的术语,形成术语定义表。
- rules:
- zh: |
- 1. 识别合同中用引号或黑体定义的专有名词(如"机密信息"、"不可抗力")
- 2. 提取术语的定义说明
- 3. 记录定义出现的条款位置
- 4. 去重:同一术语只保留一条记录
- 5. 术语名称必须与原文保持一致(包括引号)
- 6. 仅提取真正被定义的术语,不要提取普通业务词汇
- 7. 保持客观准确,不添加文本中没有的信息
- 8. 术语类型:合同标的相关的术语(项目、软件产品、技术文档)、权利义务相关的术语(投资款、服务费、违约金)、风险相关的术语(不可抗力、机密信息)、程序相关的术语(验收标准、付款条件)
-
-identifiers:
- item_id: "term"
-
-display:
- label: "{term}"
diff --git a/hyperextract/templates/presets/legal/legal_concept_ontology.yaml b/hyperextract/templates/presets/legal/legal_concept_ontology.yaml
deleted file mode 100644
index 4d81f85..0000000
--- a/hyperextract/templates/presets/legal/legal_concept_ontology.yaml
+++ /dev/null
@@ -1,99 +0,0 @@
-name: "LegalConceptOntology"
-autotype: graph
-tag: [legal]
-
-language: zh
-
-description:
- zh: "法律概念本体 - 提取法律术语的定义、上下位关系及法理阐释"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "法律概念名称,如过错、故意、过失、违法性"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "概念类型:原则、规则、学说、术语、法律依据"
- required: true
- default: ""
- - name: definition
- type: "string"
- description:
- zh: "概念的简要定义"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源概念名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标概念名称"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:上位概念、下位概念、相关联、对立、包含、依据"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "关系描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的法学专家,请从文本中提取所有法律概念以及它们之间的关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的概念,禁止将多个概念合并为一个节点
- 2. 概念名称与原文保持一致
- 3. 仅从已知概念列表中提取边,不要创建未列出的概念
- 4. 关系描述应与原文保持一致
- 5. 法律概念类型包括:原则、规则、学说、术语、法律依据
- 6. 关系类型:上位概念、下位概念、相关联、对立、包含、依据
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的概念,禁止将多个概念合并为一个节点
- 2. 概念名称与原文保持一致
- 3. 法律概念类型包括:原则、规则、学说、术语、法律依据
- 4. 常见的法律概念:过错、故意、过失、违法性、因果关系、举证责任等
- rules_for_edges:
- zh: |
- 1. 仅从已知法律概念列表中提取边,不要创建未列出的概念
- 2. 关系描述应与原文保持一致
- 3. 上位概念:概念之间的层级包含关系
- 4. 下位概念:概念之间的层级包含关系
- 5. 相关联:概念之间存在逻辑关联
- 6. 对立:概念之间存在对立关系
- 7. 包含:一个概念包含另一个概念
- 8. 依据:一个概念是另一个概念的依据
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name}({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/legal/liability_clause_list.yaml b/hyperextract/templates/presets/legal/liability_clause_list.yaml
deleted file mode 100644
index 43dc106..0000000
--- a/hyperextract/templates/presets/legal/liability_clause_list.yaml
+++ /dev/null
@@ -1,59 +0,0 @@
-name: "LiabilityClauseList"
-autotype: list
-tag: [legal]
-
-language: zh
-
-description:
- zh: "责任条款清单 - 提取关于赔偿、责任限制、保证及免责声明的具体条款"
-
-item_schema:
- fields:
- - name: clause_type
- type: "string"
- description:
- zh: "条款类型:赔偿条款、责任限制、保证条款、免责声明、违约金、连带责任、其他"
- required: true
- default: ""
- - name: clause_title
- type: "string"
- description:
- zh: "条款标题或简要名称"
- required: true
- default: ""
- - name: content
- type: "string"
- description:
- zh: "条款的具体内容"
- required: true
- default: ""
- - name: liability_amount
- type: "string"
- description:
- zh: "涉及的责任金额或计算方式,如合同总价的10%、人民币20万元等"
- required: false
- default: ""
- - name: source_clause
- type: "string"
- description:
- zh: "条款来源的章节编号"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的合同法律师,请从文本中提取所有关于责任、赔偿、保证的条款。
- rules:
- zh: |
- 1. 提取文本中所有关于责任分配的具体条款
- 2. 为每一条款指定类型:赔偿条款、责任限制、保证条款、免责声明、违约金、连带责任、其他
- 3. 记录条款的具体内容和涉及的责任金额
- 4. 记录条款来源的章节编号
- 5. 条款类型说明:赔偿条款(约定一方给另一方造成损失时的赔偿方式)、责任限制(限制某方承担责任的最高限额)、保证条款(一方对某事项的保证承诺)、免责声明(免除或限制某方责任的条款)、违约金(约定违约时支付的违约金)、连带责任(约定多方承担连带责任)、其他(不属于上述类别的责任条款)
- 6. 每项责任条款作为独立条目提取
- 7. 保持条款内容与原文一致
- 8. 不要遗漏任何责任相关条款
-
-display:
- label: "[{clause_type}] {clause_title}"
diff --git a/hyperextract/templates/presets/legal/litigation_participant_map.yaml b/hyperextract/templates/presets/legal/litigation_participant_map.yaml
deleted file mode 100644
index 567f070..0000000
--- a/hyperextract/templates/presets/legal/litigation_participant_map.yaml
+++ /dev/null
@@ -1,93 +0,0 @@
-name: "LitigationParticipantMap"
-autotype: graph
-tag: [legal]
-
-language: zh
-
-description:
- zh: "诉讼参与人图谱 - 提取原告、被告、第三人、代理律师及证人之间的关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "参与人姓名或名称"
- required: true
- default: ""
- - name: participant_type
- type: "string"
- description:
- zh: "参与人类型:原告、被告、第三人、委托诉讼代理人、法定代理人、证人、鉴定人、法官、合议庭成员"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "参与人角色描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源参与人姓名或名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标参与人姓名或名称"
- required: true
- default: ""
- - name: relation_type
- type: "string"
- description:
- zh: "关系类型:代理、代表、股东、董事、担保、上下级、同案当事人、敌对"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "关系描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的法律文书分析师,请从文本中提取诉讼参与人及其之间的关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的参与人,禁止将多个参与人合并为一个节点
- 2. 参与人名称与原文保持一致
- 3. 仅从已知参与人列表中提取边,不要创建未列出的参与人
- 4. 关系描述应与原文保持一致
- 5. 参与人类型:原告、被告、第三人、委托诉讼代理人、法定代理人、证人、鉴定人、法官、合议庭成员
- 6. 关系类型:代理、代表、股东、董事、担保、上下级、同案当事人、敌对
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的参与人,禁止将多个参与人合并为一个节点
- 2. 参与人名称与原文保持一致
- 3. 参与人类型:原告、被告、第三人、委托诉讼代理人、法定代理人、证人、鉴定人、法官、合议庭成员
- rules_for_edges:
- zh: |
- 1. 仅从已知参与人列表中提取边,不要创建未列出的参与人
- 2. 关系描述应与原文保持一致
- 3. 关系类型:代理、代表、股东、董事、担保、上下级、同案当事人、敌对
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relation_type}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({participant_type})"
- edge_label: "{relation_type}"
diff --git a/hyperextract/templates/presets/medicine/adverse_reaction_stats.yaml b/hyperextract/templates/presets/medicine/adverse_reaction_stats.yaml
deleted file mode 100644
index 1fef34b..0000000
--- a/hyperextract/templates/presets/medicine/adverse_reaction_stats.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
-name: "AdverseReactionStats"
-autotype: list
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "不良反应统计 - 提取各系统的不良反应表现及其发生率描述"
-
-item_schema:
- fields:
- - name: system
- type: "string"
- description:
- zh: "系统名称,如胃肠道、全身、皮肤等"
- - name: reaction
- type: "string"
- description:
- zh: "不良反应表现"
- - name: incidence
- type: "string"
- description:
- zh: "发生率"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的临床药师,请从文本中提取各系统的不良反应表现及其发生率描述,构建不良反应统计。
-
- rules:
- zh: |
- 1. 提取所有不良反应,包括系统名称、不良反应表现和发生率
- 2. 为每个不良反应添加详细描述(如果文本中提供)
- 3. 保持不良反应表现与原文一致
-
- rules_for_nodes:
- zh: |
- - 不良反应名称保持原文
- - 发生率表示法保持原文,如 5.2%、常见、罕见
-
-display:
- label: "{system}: {reaction} ({incidence})"
diff --git a/hyperextract/templates/presets/medicine/anatomy_hierarchy.yaml b/hyperextract/templates/presets/medicine/anatomy_hierarchy.yaml
deleted file mode 100644
index 69310ee..0000000
--- a/hyperextract/templates/presets/medicine/anatomy_hierarchy.yaml
+++ /dev/null
@@ -1,80 +0,0 @@
-name: "AnatomyHierarchy"
-autotype: graph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "解剖层级树 - 构建解剖位置的包含和毗邻关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "解剖结构名称,如器官、组织、血管等"
- - name: category
- type: "string"
- description:
- zh: "解剖类型:器官、组织、血管、神经、骨骼等"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源解剖结构"
- - name: target
- type: "string"
- description:
- zh: "目标解剖结构"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:包含、毗邻、分支、供应等"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的解剖学家,请从文本中提取解剖结构及其关系,构建解剖层级树。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
-
- rules_for_nodes:
- zh: |
- - 解剖学术语保持原文,如解剖结构名称(心脏、肝脏、主动脉)
-
- rules_for_edges:
- zh: |
- - 包含:解剖结构之间的包含关系
- - 毗邻:解剖结构之间的相邻关系
- - 分支:血管或神经的分支关系
- - 供应:血管供应区域的关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/medicine/clinical_pathway.yaml b/hyperextract/templates/presets/medicine/clinical_pathway.yaml
deleted file mode 100644
index 22585dc..0000000
--- a/hyperextract/templates/presets/medicine/clinical_pathway.yaml
+++ /dev/null
@@ -1,78 +0,0 @@
-name: "ClinicalPathway"
-autotype: graph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "临床路径图 - 提取 '如果症状A则检查B否则治疗C' 的决策树结构"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "节点名称,如症状、检查、治疗等"
- - name: category
- type: "string"
- description:
- zh: "节点类型:症状、检查、治疗、诊断、决策点等"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源节点"
- - name: target
- type: "string"
- description:
- zh: "目标节点"
- - name: condition
- type: "string"
- description:
- zh: "条件描述,如如果症状A则"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的临床医生,请从文本中提取"如果症状A则检查B否则治疗C"的决策树结构,构建临床路径图。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
-
- rules_for_nodes:
- zh: |
- - 医学专业术语保持原文,如检查项目名称、药物名称
- - 临床术语保持原文,如心电图、血常规
-
- rules_for_edges:
- zh: |
- - 条件描述应清晰表达决策逻辑
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{condition}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{condition}"
diff --git a/hyperextract/templates/presets/medicine/complex_interaction_net.yaml b/hyperextract/templates/presets/medicine/complex_interaction_net.yaml
deleted file mode 100644
index 032fdc4..0000000
--- a/hyperextract/templates/presets/medicine/complex_interaction_net.yaml
+++ /dev/null
@@ -1,77 +0,0 @@
-name: "ComplexInteractionNet"
-autotype: hypergraph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "条件性相互作用网 - 建模 '药A+药B+特定体质 -> 不良反应' 的高阶依赖"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如药物、体质、不良反应等"
- - name: category
- type: "string"
- description:
- zh: "实体类型:药物、体质、不良反应、其他等"
- - name: description
- type: "string"
- description:
- zh: "简要描述,如药物的功能、作用等"
- required: false
-
-edge_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "超边名称,如药物相互作用"
- - name: nodes
- type: "array"
- description:
- zh: "参与超边的节点列表"
- - name: interactionType
- type: "string"
- description:
- zh: "相互作用类型:增强、减弱、不良反应等"
- - name: details
- type: "string"
- description:
- zh: "详细描述,如具体的相互作用机制"
-
-guide:
- target:
- zh: |
- 你是一位专业的临床药师,请从文本中提取药物相互作用信息,构建条件性相互作用网。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
-
- rules_for_nodes:
- zh: |
- - 药物名称保持原文,如二甲双胍、磺酰脲类
- - 不良反应名称保持原文
-
- rules_for_edges:
- zh: |
- - 增强:药物作用相互增强
- - 减弱:药物作用相互减弱
- - 不良反应:药物组合导致不良反应
-
-identifiers:
- node_id: "name"
- edge_id: "name"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "name"
diff --git a/hyperextract/templates/presets/medicine/contraindication_list.yaml b/hyperextract/templates/presets/medicine/contraindication_list.yaml
deleted file mode 100644
index 6ba0c83..0000000
--- a/hyperextract/templates/presets/medicine/contraindication_list.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: "ContraindicationList"
-autotype: list
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "禁忌症清单 - 提取绝对禁忌(如孕妇、严重肾衰竭等)的明确列表"
-
-item_schema:
- fields:
- - name: contraindication
- type: "string"
- description:
- zh: "禁忌症描述"
- - name: contraindicationType
- type: "string"
- description:
- zh: "禁忌症类型:绝对禁忌、相对禁忌等"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的临床药师,请从文本中提取绝对禁忌(如孕妇、严重肾衰竭等)的明确列表,构建禁忌症清单。
-
- rules:
- zh: |
- 1. 提取所有禁忌症,包括绝对禁忌和相对禁忌
- 2. 为每个禁忌症指定类型:绝对禁忌、相对禁忌等
- 3. 为每个禁忌症添加详细描述(如果文本中提供)
- 4. 保持禁忌症描述与原文一致
-
- rules_for_nodes:
- zh: |
- - 禁忌症名称保持原文
- - 医学术语保持原文
-
-display:
- label: "{contraindication} ({contraindicationType})"
diff --git a/hyperextract/templates/presets/medicine/discharge_instruction.yaml b/hyperextract/templates/presets/medicine/discharge_instruction.yaml
deleted file mode 100644
index dcbe79d..0000000
--- a/hyperextract/templates/presets/medicine/discharge_instruction.yaml
+++ /dev/null
@@ -1,62 +0,0 @@
-name: "DischargeInstruction"
-autotype: model
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "出院医嘱摘要 - 提取出院带药、复诊计划及康复建议的结构化信息"
-
-schema:
- fields:
- - name: medications
- type: "array"
- description:
- zh: "出院带药列表,每个药物包含名称、剂量、用法、频次等信息"
- required: false
- - name: followUp
- type: "array"
- description:
- zh: "复诊计划列表,每个复诊包含时间、科室、检查项目等信息"
- required: false
- - name: rehabilitation
- type: "array"
- description:
- zh: "康复建议列表"
- required: false
- - name: diet
- type: "array"
- description:
- zh: "饮食建议列表"
- required: false
- - name: activity
- type: "array"
- description:
- zh: "活动建议列表"
- required: false
- - name: notes
- type: "array"
- description:
- zh: "其他注意事项列表"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的医生,请从文本中提取出院带药、复诊计划及康复建议的结构化信息,构建出院医嘱摘要。
-
- rules:
- zh: |
- 1. 提取所有出院带药信息,每个药物包含名称、剂量、用法、频次等信息
- 2. 提取所有复诊计划信息,每个复诊包含时间、科室、检查项目等信息
- 3. 提取所有康复建议、饮食建议、活动建议和其他注意事项
- 4. 保持信息与原文一致
-
- rules_for_nodes:
- zh: |
- - 药物名称保持原文,如阿司匹林、二甲双胍
- - 剂量单位保持原文,如 mg、ml
- - 医学缩写保持原文,如 qd(每日一次)、bid(每日两次)
-
-display:
- label: "出院医嘱摘要"
diff --git a/hyperextract/templates/presets/medicine/hospital_course_timeline.yaml b/hyperextract/templates/presets/medicine/hospital_course_timeline.yaml
deleted file mode 100644
index af31e5d..0000000
--- a/hyperextract/templates/presets/medicine/hospital_course_timeline.yaml
+++ /dev/null
@@ -1,97 +0,0 @@
-name: "HospitalCourseTimeline"
-autotype: temporal_graph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "住院病程时间轴 - 严格按时间顺序提取入院、检查、治疗、转归等节点"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "节点名称,如入院、检查、治疗、转归等"
- - name: category
- type: "string"
- description:
- zh: "节点类型:入院、检查、治疗、手术、转归、其他等"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源节点"
- - name: target
- type: "string"
- description:
- zh: "目标节点"
- - name: eventType
- type: "string"
- description:
- zh: "事件类型:入院、检查、治疗、手术、转归等"
- - name: eventDate
- type: "string"
- description:
- zh: "事件日期,格式为年-月-日"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的医院管理人员,请从文本中严格按时间顺序提取入院、检查、治疗、转归等节点,构建住院病程时间轴。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
-
- rules_for_nodes:
- zh: |
- - 医学术语保持原文
-
- rules_for_edges:
- zh: |
- - 记录事件之间的时间顺序关系
-
- rules_for_time:
- zh: |
- 当前观察日期:{observation_time}
-
- 1. 相对时间解析(基于观察日期):
- - "去年" → {observation_time} 的前一年
- - "上月" → {observation_time} 的前一个月
- - "本季度" → {observation_time} 所在季度
- - "近期" → {observation_time} 最近 3 个月
- - "入院当天" → 使用入院日期
- - "术后第一天" → 手术日期的后一天
-
- 2. 精确时间 → 保持原样
- 3. 时间缺失 → 留空,不要猜测
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{eventType}|{target}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "eventDate"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{eventType} ({eventDate})"
diff --git a/hyperextract/templates/presets/medicine/level_of_evidence.yaml b/hyperextract/templates/presets/medicine/level_of_evidence.yaml
deleted file mode 100644
index fd014e4..0000000
--- a/hyperextract/templates/presets/medicine/level_of_evidence.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
-name: "LevelOfEvidence"
-autotype: list
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "证据评级表 - 提取指南中的具体推荐意见及其对应的证据等级"
-
-item_schema:
- fields:
- - name: topic
- type: "string"
- description:
- zh: "推荐主题,如血糖控制、血脂管理、阿司匹林使用等"
- - name: summary
- type: "string"
- description:
- zh: "推荐意见摘要,简短概括该推荐的核心内容,不超过10字"
- - name: recommendation
- type: "string"
- description:
- zh: "推荐意见"
- - name: evidenceLevel
- type: "string"
- description:
- zh: "证据等级,如A、B、C、1a、1b等"
- - name: recommendationLevel
- type: "string"
- description:
- zh: "推荐级别,如强推荐、弱推荐等"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的循证医学专家,请从文本中提取指南中的具体推荐意见及其对应的证据等级,构建证据评级表。
-
- rules:
- zh: |
- 1. 提取所有推荐意见及其对应的证据等级
- 2. 为每个推荐意见指定推荐主题(topic)
- 3. 为每个推荐意见提取摘要(summary),不超过10字
- 4. 为每个推荐意见指定推荐级别
- 5. 为每个推荐意见添加详细描述(如果文本中提供)
- 6. 保持推荐意见与原文一致
-
- rules_for_nodes:
- zh: |
- - 证据等级保持原文,如 A、B、C、1a、1b
- - 医学术语保持原文
-
-display:
- label: "{topic} [{evidenceLevel}]"
diff --git a/hyperextract/templates/presets/medicine/medical_concept_net.yaml b/hyperextract/templates/presets/medicine/medical_concept_net.yaml
deleted file mode 100644
index a243b6d..0000000
--- a/hyperextract/templates/presets/medicine/medical_concept_net.yaml
+++ /dev/null
@@ -1,84 +0,0 @@
-name: "MedicalConceptNet"
-autotype: graph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "医学概念网络 - 提取医学术语及其关联属性(如:属于、定义为)"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "概念名称,如医学术语、疾病名称、解剖部位等"
- - name: category
- type: "string"
- description:
- zh: "概念类型:疾病、解剖部位、生理过程、药物、症状、体征等"
- - name: definition
- type: "string"
- description:
- zh: "概念定义"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源概念"
- - name: target
- type: "string"
- description:
- zh: "目标概念"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:属于、定义为、包含、组成、位于、导致、治疗等"
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的医学术语专家,请从文本中提取医学术语及其关联属性,构建医学概念网络。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
-
- rules_for_nodes:
- zh: |
- - 医学术语保持原文,如疾病名称、解剖部位名称
- - 专业缩写保持原文,如 ECG、CT、MRI
-
- rules_for_edges:
- zh: |
- - 属于:概念归属关系
- - 定义为:概念定义关系
- - 包含:包含关系
- - 组成:组成关系
- - 位于:位置关系
- - 导致:因果关系
- - 治疗:治疗关系
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/medicine/microscopic_feature_set.yaml b/hyperextract/templates/presets/medicine/microscopic_feature_set.yaml
deleted file mode 100644
index d0147e4..0000000
--- a/hyperextract/templates/presets/medicine/microscopic_feature_set.yaml
+++ /dev/null
@@ -1,52 +0,0 @@
-name: "MicroscopicFeatureSet"
-autotype: set
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "微观特征集 - 提取免疫组化指标(如 HER2+, Ki67)及基因突变状态"
-
-item_schema:
- fields:
- - name: featureName
- type: "string"
- description:
- zh: "特征名称,如免疫组化指标、基因突变等"
- - name: featureType
- type: "string"
- description:
- zh: "特征类型:免疫组化、基因突变、其他等"
- - name: value
- type: "string"
- description:
- zh: "特征值,如阳性、阴性、百分比等"
- - name: description
- type: "string"
- description:
- zh: "特征描述"
- required: false
-
-guide:
- target:
- zh: |
- 你是一位专业的病理学家,请从文本中提取免疫组化指标(如 HER2+, Ki67)及基因突变状态,构建微观特征集。
-
- rules:
- zh: |
- 1. 提取所有免疫组化指标和基因突变状态
- 2. 为每个特征指定类型:免疫组化、基因突变、其他等
- 3. 为每个特征添加特征值,如阳性、阴性、百分比等
- 4. 为每个特征添加简要描述(如果文本中提供)
- 5. 保持特征名称与原文一致
-
- rules_for_nodes:
- zh: |
- - 免疫组化指标保持原文,如 HER2、Ki67、ER、PR
- - 基因突变名称保持原文,如 BRCA1、KRAS、TP53
-
-identifiers:
-item_id: "featureName"
-
-display:
- label: "{featureName} ({featureType})"
diff --git a/hyperextract/templates/presets/medicine/pathology_hypergraph.yaml b/hyperextract/templates/presets/medicine/pathology_hypergraph.yaml
deleted file mode 100644
index 114ffc5..0000000
--- a/hyperextract/templates/presets/medicine/pathology_hypergraph.yaml
+++ /dev/null
@@ -1,82 +0,0 @@
-name: "PathologyHypergraph"
-autotype: hypergraph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "多因素病理机制图 - 建模 '基因+环境+诱因 -> 疾病' 的复杂致病逻辑"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如基因、环境因素、诱因、疾病等"
- - name: category
- type: "string"
- description:
- zh: "实体类型:基因、环境因素、诱因、疾病、病理过程、症状等"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: mechanism_name
- type: "string"
- description:
- zh: "机制名称,简短描述性名称"
- - name: participating_entities
- type: "array"
- description:
- zh: "参与此病理机制的所有实体名称列表"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:致病、诱发、促进、抑制等"
- - name: details
- type: "string"
- description:
- zh: "详细描述,如具体的致病机制"
- - name: outcome
- type: "string"
- description:
- zh: "该机制导致的结果或效应"
-
-guide:
- target:
- zh: |
- 你是一位专业的病理学家,请从文本中提取与疾病病理机制相关的实体和它们之间的复杂关联关系,构建多因素病理机制图。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
-
- rules_for_nodes:
- zh: |
- - 医学专业术语保持原文,如基因名称(BRCA1、KRAS、TP53)、蛋白名称
- - 疾病名称保持原文,如慢性阻塞性肺疾病、肺癌
-
- rules_for_edges:
- zh: |
- - 致病:导致疾病发生
- - 诱发:诱发疾病发作
- - 促进:促进疾病进展
- - 抑制:抑制疾病发展
-
-identifiers:
- node_id: "name"
- edge_id: "mechanism_name"
- edge_members: "participating_entities"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "[{relationType}] {mechanism_name}"
diff --git a/hyperextract/templates/presets/medicine/pharmacology_graph.yaml b/hyperextract/templates/presets/medicine/pharmacology_graph.yaml
deleted file mode 100644
index af2dfc8..0000000
--- a/hyperextract/templates/presets/medicine/pharmacology_graph.yaml
+++ /dev/null
@@ -1,83 +0,0 @@
-name: "PharmacologyGraph"
-autotype: graph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "药理机制图 - 提取药物、受体、靶点及生理反应之间的相互作用路径"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如药物、受体、靶点、生理反应等"
- - name: category
- type: "string"
- description:
- zh: "实体类型:药物、受体、靶点、生理反应、信号通路等"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体"
- - name: target
- type: "string"
- description:
- zh: "目标实体"
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:结合、激活、抑制、调节、诱导、拮抗等"
- - name: details
- type: "string"
- description:
- zh: "详细描述,如具体的作用机制"
-
-guide:
- target:
- zh: |
- 你是一位专业的药理学家,请从文本中提取药物、受体、靶点及生理反应之间的相互作用路径,构建药理机制图。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
-
- rules_for_nodes:
- zh: |
- - 药物名称保持原文,如二甲双胍、阿司匹林
- - 受体名称保持原文,如胰岛素受体、肾上腺素受体
- - 信号通路名称保持原文,如AMPK通路、PI3K/Akt通路
-
- rules_for_edges:
- zh: |
- - 结合:药物与受体结合
- - 激活:激活受体或通路
- - 抑制:抑制受体或通路
- - 调节:调节生理反应
- - 诱导:诱导特定反应
- - 拮抗:拮抗作用
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/medicine/surgical_event_graph.yaml b/hyperextract/templates/presets/medicine/surgical_event_graph.yaml
deleted file mode 100644
index 211a37c..0000000
--- a/hyperextract/templates/presets/medicine/surgical_event_graph.yaml
+++ /dev/null
@@ -1,83 +0,0 @@
-name: "SurgicalEventGraph"
-autotype: hypergraph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "手术事件超图 - 将手术建模为连接 {医生, 部位, 术式, 器械} 共同参与的复杂事件"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如医生、部位、术式、器械等"
- - name: category
- type: "string"
- description:
- zh: "实体类型:医生、部位、术式、器械、麻醉方式等"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "超边名称,如手术名称"
- - name: nodes
- type: "array"
- description:
- zh: "参与超边的节点列表"
- - name: date
- type: "string"
- description:
- zh: "手术日期"
- - name: duration
- type: "string"
- description:
- zh: "手术时长"
- required: false
- - name: details
- type: "string"
- description:
- zh: "详细描述,如手术过程"
-
-guide:
- target:
- zh: |
- 你是一位专业的外科医生,请从文本中提取手术事件及其相关实体,构建手术事件超图。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 超边连接2个或多个实体
-
- rules_for_nodes:
- zh: |
- - 医生:手术主刀医生及参与人员
- - 部位:手术部位
- - 术式:具体手术方式
- - 器械:使用的医疗器械
-
- rules_for_edges:
- zh: |
- - 一个超边代表一个完整的手术事件
- - 需要包含手术的时间、地点、参与人员等信息
-
-identifiers:
- node_id: "name"
- edge_id: "name"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{name} ({date})"
diff --git a/hyperextract/templates/presets/medicine/treatment_regimen_map.yaml b/hyperextract/templates/presets/medicine/treatment_regimen_map.yaml
deleted file mode 100644
index 68bbbf1..0000000
--- a/hyperextract/templates/presets/medicine/treatment_regimen_map.yaml
+++ /dev/null
@@ -1,76 +0,0 @@
-name: "TreatmentRegimenMap"
-autotype: hypergraph
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "综合治疗方案图 - 提取由 药物组合+理疗+生活干预 构成的多因素治疗方案"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如药物、理疗方法、生活干预等"
- - name: category
- type: "string"
- description:
- zh: "实体类型:药物、理疗、生活干预、检查、手术等"
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
-
-edge_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "超边名称,如治疗方案、康复计划等"
- - name: nodes
- type: "array"
- description:
- zh: "参与超边的节点列表"
- - name: disease
- type: "string"
- description:
- zh: "针对的疾病"
- - name: details
- type: "string"
- description:
- zh: "详细描述,如具体的治疗方案内容"
-
-guide:
- target:
- zh: |
- 你是一位专业的临床医生,请从文本中提取由"药物组合+理疗+生活干预"构成的多因素治疗方案,构建综合治疗方案图。
-
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 超边必须包含多个节点
-
- rules_for_nodes:
- zh: |
- - 药物名称保持原文,如二甲双胍、阿司匹林
- - 治疗方式保持原文,如放疗、化疗、手术
-
- rules_for_edges:
- zh: |
- - 一个超边代表一个完整的治疗方案
- - 需要包含针对的疾病信息
-
-identifiers:
- node_id: "name"
- edge_id: "name"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{name} - {disease}"
diff --git a/hyperextract/templates/presets/medicine/tumor_staging_item.yaml b/hyperextract/templates/presets/medicine/tumor_staging_item.yaml
deleted file mode 100644
index 0ff347f..0000000
--- a/hyperextract/templates/presets/medicine/tumor_staging_item.yaml
+++ /dev/null
@@ -1,61 +0,0 @@
-name: "TumorStagingItem"
-autotype: model
-tag: [medicine]
-
-language: zh
-
-description:
- zh: "TNM分期表 - 提取肿瘤大小(T)、淋巴结(N)、转移(M)及分期结果"
-
-schema:
- fields:
- - name: tStage
- type: "string"
- description:
- zh: "T分期,如T1、T2、T3、T4等"
- - name: nStage
- type: "string"
- description:
- zh: "N分期,如N0、N1、N2、N3等"
- - name: mStage
- type: "string"
- description:
- zh: "M分期,如M0、M1等"
- - name: pathologicalStage
- type: "string"
- description:
- zh: "病理分期,如I期、II期、III期、IV期等"
- - name: tDetails
- type: "string"
- description:
- zh: "T分期详细描述,如肿瘤大小"
- - name: nDetails
- type: "string"
- description:
- zh: "N分期详细描述,如淋巴结转移数量"
- - name: mDetails
- type: "string"
- description:
- zh: "M分期详细描述,如远处转移部位"
-
-guide:
- target:
- zh: |
- 你是一位专业的病理学家,请从文本中提取肿瘤大小(T)、淋巴结(N)、转移(M)及分期结果,构建TNM分期表。
-
- rules:
- zh: |
- 1. 提取T分期、N分期、M分期和病理分期
- 2. 为每个分期添加详细描述:
- - T分期详细描述:肿瘤大小、浸润深度等
- - N分期详细描述:淋巴结转移数量、部位等
- - M分期详细描述:远处转移部位等
- 3. 保持信息与原文一致
-
- rules_for_nodes:
- zh: |
- - TNM分期表示法保持原文,如 T1、T2、N0、M0
- - 分期表示法保持原文,如 I期、II期、III期、IV期
-
-display:
- label: "TNM分期: {tStage}{nStage}{mStage} ({pathologicalStage})"
diff --git a/hyperextract/templates/presets/tcm/acupoint_location_map.yaml b/hyperextract/templates/presets/tcm/acupoint_location_map.yaml
deleted file mode 100644
index 480eae4..0000000
--- a/hyperextract/templates/presets/tcm/acupoint_location_map.yaml
+++ /dev/null
@@ -1,99 +0,0 @@
-name: "AcupointLocationMap"
-autotype: graph
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "腧穴空间定位 - 基于人体解剖标志提取穴位的相对位置关系(如 '脐旁2寸')"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "穴位名称:如合谷、足三里、三阴交等"
- required: true
- default: ""
- - name: meridian
- type: "string"
- description:
- zh: "所属经脉"
- required: false
- default: ""
- - name: location
- type: "string"
- description:
- zh: "位置描述:如脐旁2寸、腕横纹上3寸等"
- required: false
- default: ""
- - name: indications
- type: "string"
- description:
- zh: "主治功能"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源穴位或解剖标志名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标穴位名称"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:位于"
- required: true
- default: ""
- - name: relativePosition
- type: "string"
- description:
- zh: "相对位置描述:如脐旁2寸、腕横纹上3寸等"
- required: true
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的针灸学专家,请从文本中提取穴位的相对位置关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 穴位:针灸特定位置,如合谷、足三里、三阴交
- 6. 解剖标志:人体解剖部位,如腕横纹、第2掌骨
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 穴位:针灸特定位置
- 4. 解剖标志:人体解剖部位
- rules_for_edges:
- zh: |
- 1. 仅从已知穴位列表中提取边,不要创建未列出的穴位
- 2. 关系描述应与原文保持一致
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name}"
- edge_label: "{relationType}: {relativePosition}"
diff --git a/hyperextract/templates/presets/tcm/compatibility_net.yaml b/hyperextract/templates/presets/tcm/compatibility_net.yaml
deleted file mode 100644
index 93903d6..0000000
--- a/hyperextract/templates/presets/tcm/compatibility_net.yaml
+++ /dev/null
@@ -1,85 +0,0 @@
-name: "CompatibilityNet"
-autotype: graph
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "七情配伍网络 - 提取药物间的相须、相使、相畏、相杀、十八反十九畏关系"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "药物名称"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源药物"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标药物"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "配伍关系类型:相须、相使、相畏、相杀、相恶、相反、十八反、十九畏"
- required: true
- default: ""
- - name: effect
- type: "string"
- description:
- zh: "配伍效果描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的中药配伍专家,请从文本中提取药物间的配伍关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 配伍关系类型:相须、相使、相畏、相杀、相恶、相反、十八反、十九畏
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- rules_for_edges:
- zh: |
- 1. 仅从已知药物列表中提取边,不要创建未列出的药物
- 2. 关系描述应与原文保持一致
- 3. 配伍关系类型:相须、相使、相畏、相杀、相恶、相反、十八反、十九畏
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name}"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/tcm/formula_composition.yaml b/hyperextract/templates/presets/tcm/formula_composition.yaml
deleted file mode 100644
index 28d2ad0..0000000
--- a/hyperextract/templates/presets/tcm/formula_composition.yaml
+++ /dev/null
@@ -1,129 +0,0 @@
-name: "FormulaComposition"
-autotype: hypergraph
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "君臣佐使结构图 - 将方剂建模为 {君药, 臣药, 佐药, 使药} 的层级化超边结构"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "药物名称"
- required: true
- default: ""
- - name: nature
- type: "string"
- description:
- zh: "性味,如:辛温、苦寒、甘平"
- required: false
- default: ""
- - name: meridian
- type: "string"
- description:
- zh: "归经,如:归肺经、归脾经、归心经"
- required: false
- default: ""
- - name: effect
- type: "string"
- description:
- zh: "功效,如:发汗解表、温通经脉、补气健脾"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: formulaName
- type: "string"
- description:
- zh: "方剂名称"
- required: true
- default: ""
- - name: source
- type: "string"
- description:
- zh: "方剂来源,如:伤寒论、金匮要略、方剂学教材"
- required: false
- default: ""
- - name: junHerbs
- type: "array"
- description:
- zh: "君药列表(包含药物名称、剂量、炮制方法)"
- required: false
- default: ""
- - name: chenHerbs
- type: "array"
- description:
- zh: "臣药列表(包含药物名称、剂量、炮制方法)"
- required: false
- default: ""
- - name: zuoHerbs
- type: "array"
- description:
- zh: "佐药列表(包含药物名称、剂量、炮制方法)"
- required: false
- default: ""
- - name: shiHerbs
- type: "array"
- description:
- zh: "使药列表(包含药物名称、剂量、炮制方法)"
- required: false
- default: ""
- - name: functions
- type: "array"
- description:
- zh: "方剂功能,如:解肌发表、调和营卫"
- required: false
- default: ""
- - name: indications
- type: "array"
- description:
- zh: "主治证候,如:外感风寒表虚证"
- required: false
- default: ""
- - name: decoctionMethod
- type: "string"
- description:
- zh: "煎服法,如:水煎服,日三服"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的方剂学专家,请从文本中提取方剂的君臣佐使结构。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 药物固有属性:性味、归经、功效(不随方剂变化)
- 4. 药物在方剂中的属性:剂量、炮制方法、角色(君/臣/佐/使)
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 药物固有属性:性味、归经、功效
- rules_for_edges:
- zh: |
- 1. 仅从已知药物列表中提取边,不要创建未列出的药物
- 2. 关系描述应与原文保持一致
- 3. 药物角色:君药、臣药、佐药、使药
-
-identifiers:
- node_id: "name"
- edge_id: "formulaName"
- edge_members:
- - "junHerbs"
- - "chenHerbs"
- - "zuoHerbs"
- - "shiHerbs"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name}"
- edge_label: "{formulaName}"
diff --git a/hyperextract/templates/presets/tcm/function_indication_map.yaml b/hyperextract/templates/presets/tcm/function_indication_map.yaml
deleted file mode 100644
index 143ffb0..0000000
--- a/hyperextract/templates/presets/tcm/function_indication_map.yaml
+++ /dev/null
@@ -1,96 +0,0 @@
-name: "FunctionIndicationMap"
-autotype: graph
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "主治功效映射 - 关联 方剂 -> 功能(如清热解毒) -> 主治证候"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "实体类型:方剂、功能、主治证候"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源实体"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标实体"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:具有功能、主治"
- required: true
- default: ""
- - name: details
- type: "string"
- description:
- zh: "详细描述"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的方剂学专家,请从文本中提取方剂、功能和主治证候之间的关联关系。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 方剂:如桂枝汤、麻黄汤
- 6. 功能:如解肌发表、清热解毒
- 7. 主治证候:如太阳中风、外感风寒
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 方剂:如桂枝汤、麻黄汤
- 4. 功能:如解肌发表、清热解毒
- 5. 主治证候:如太阳中风、外感风寒
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 关系类型:具有功能、主治
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
diff --git a/hyperextract/templates/presets/tcm/herb_property_model.yaml b/hyperextract/templates/presets/tcm/herb_property_model.yaml
deleted file mode 100644
index b90ee65..0000000
--- a/hyperextract/templates/presets/tcm/herb_property_model.yaml
+++ /dev/null
@@ -1,98 +0,0 @@
-name: "HerbPropertyModel"
-autotype: model
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "药物性味归经 - 提取单味药的四气五味、归经、毒性及推荐剂量"
-
-schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "药物正名"
- required: true
- default: ""
- - name: alternativeNames
- type: "array"
- description:
- zh: "别名、俗称"
- required: false
- default: ""
- - name: properties
- type: "array"
- description:
- zh: "四气:寒、热、温、凉、平"
- required: false
- default: ""
- - name: flavors
- type: "array"
- description:
- zh: "五味:酸、苦、甘、辛、咸"
- required: false
- default: ""
- - name: meridians
- type: "array"
- description:
- zh: "归经:如肺经、肝经、脾经等"
- required: false
- default: ""
- - name: toxicity
- type: "string"
- description:
- zh: "毒性:无毒、小毒、有毒、大毒"
- required: false
- default: "无毒"
- - name: dosage
- type: "string"
- description:
- zh: "推荐剂量"
- required: false
- default: ""
- - name: collection
- type: "string"
- description:
- zh: "采集时间和方法"
- required: false
- default: ""
- - name: processing
- type: "string"
- description:
- zh: "炮制方法"
- required: false
- default: ""
- - name: indications
- type: "array"
- description:
- zh: "功效主治"
- required: false
- default: ""
- - name: contraindications
- type: "array"
- description:
- zh: "配伍禁忌"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的中药学家,请从文本中提取单味药的性味归经、毒性及推荐剂量等信息。
- rules:
- zh: |
- 1. 识别文本的核心药物主体
- 2. 提取药物的正名和所有别名、俗称
- 3. 提取药物的四气(寒、热、温、凉、平)
- 4. 提取药物的五味(酸、苦、甘、辛、咸)
- 5. 提取药物的归经(如肺经、肝经、脾经等)
- 6. 提取药物的毒性(无毒、小毒、有毒、大毒)
- 7. 提取药物的推荐剂量
- 8. 句式解析:文言文常采用省略主语、并列结构、连动句式,需先理解句式结构再提取信息
- 9. 术语对应:文言术语与现代术语需正确对应(如"主"指"主治","疗"指"治疗")
- 10. 连写拆分:文言中常连写多个属性(如"味甘微寒"→拆分为"味甘"、"微寒"),需分别归到对应字段
- 11. 古代剂量:文言中古代剂量单位(如两、钱、匕)可保留原文
-
-display:
- label: "{name} ({properties},{flavors})"
diff --git a/hyperextract/templates/presets/tcm/meridian_flow_graph.yaml b/hyperextract/templates/presets/tcm/meridian_flow_graph.yaml
deleted file mode 100644
index 218d311..0000000
--- a/hyperextract/templates/presets/tcm/meridian_flow_graph.yaml
+++ /dev/null
@@ -1,106 +0,0 @@
-name: "MeridianFlowGraph"
-autotype: graph
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "经络流注图 - 提取十二经脉的循行路线及经气流注次序"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "经脉名称:如手太阴肺经、手阳明大肠经等"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "经脉类别:阴经、阳经"
- required: true
- default: ""
- - name: associatedOrgan
- type: "string"
- description:
- zh: "关联脏腑"
- required: false
- default: ""
- - name: circulationPath
- type: "string"
- description:
- zh: "循行路线"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: source
- type: "string"
- description:
- zh: "源经脉名称"
- required: true
- default: ""
- - name: target
- type: "string"
- description:
- zh: "目标经脉名称"
- required: true
- default: ""
- - name: relationType
- type: "string"
- description:
- zh: "关系类型:流注"
- required: true
- default: ""
- - name: flowOrder
- type: "int"
- description:
- zh: "流注次序"
- required: true
- default: "0"
- - name: connectionPoint
- type: "string"
- description:
- zh: "连接部位"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的经络学专家,请从文本中提取十二经脉的循行路线及经气流注次序。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 关系描述应与原文保持一致
- 5. 经脉:十二经脉,如手太阴肺经、手阳明大肠经
- 6. 经脉类别:阴经、阳经
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 经脉:十二经脉
- 4. 经脉类别:阴经、阳经
- rules_for_edges:
- zh: |
- 1. 仅从已知经脉列表中提取边,不要创建未列出的经脉
- 2. 关系描述应与原文保持一致
- 3. 关系类型:流注
-
-identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "流注 #{flowOrder}"
diff --git a/hyperextract/templates/presets/tcm/prescription_modification.yaml b/hyperextract/templates/presets/tcm/prescription_modification.yaml
deleted file mode 100644
index 4d1376b..0000000
--- a/hyperextract/templates/presets/tcm/prescription_modification.yaml
+++ /dev/null
@@ -1,102 +0,0 @@
-name: "PrescriptionModification"
-autotype: hypergraph
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "处方加减逻辑 - 提取基于特定证型或症状对基础方剂进行的药物加减(如'随证加减')"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "实体类型:基础方、药物、证型、症状"
- required: true
- default: ""
-
-edge_schema:
- fields:
- - name: baseFormula
- type: "string"
- description:
- zh: "基础方剂名称"
- required: true
- default: ""
- - name: condition
- type: "string"
- description:
- zh: "加减条件(证型或症状)"
- required: true
- default: ""
- - name: modificationType
- type: "string"
- description:
- zh: "加减类型:加、减、替换"
- required: true
- default: ""
- - name: herbs
- type: "array"
- description:
- zh: "加减药物列表"
- required: true
- default: ""
- - name: reason
- type: "string"
- description:
- zh: "加减原因"
- required: false
- default: ""
- - name: dosage
- type: "string"
- description:
- zh: "调整后的剂量"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的中医方剂专家,请从文本中提取处方加减的实体和超边结构。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 基础方:方剂名称,如桂枝汤、麻黄汤、小柴胡汤
- 5. 药物:中药名称,如葛根、厚朴、杏仁、附子
- 6. 证型/症状:临床表现,如项背强几几、喘、腹满痛
- 7. 加减类型:加、减、替换
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 基础方:方剂名称,如桂枝汤、麻黄汤、小柴胡汤
- 4. 药物:中药名称,如葛根、厚朴、杏仁、附子
- 5. 证型/症状:临床表现,如项背强几几、喘、腹满痛
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 加减类型:加、减、替换(通过 modificationType 字段区分)
-
-identifiers:
- node_id: "name"
- edge_id: "{baseFormula}|{condition}"
- edge_members:
- - "baseFormula"
- - "herbs"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{baseFormula} | {condition}"
diff --git a/hyperextract/templates/presets/tcm/processing_method.yaml b/hyperextract/templates/presets/tcm/processing_method.yaml
deleted file mode 100644
index 5764c11..0000000
--- a/hyperextract/templates/presets/tcm/processing_method.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
-name: "ProcessingMethod"
-autotype: list
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "炮制方法列表 - 提取药物的不同炮制方法(如蜜炙、酒炒)及其对药效的影响"
-
-item_schema:
- fields:
- - name: herbName
- type: "string"
- description:
- zh: "药物名称"
- required: true
- default: ""
- - name: methodName
- type: "string"
- description:
- zh: "炮制方法名称:如蜜炙、酒炒、醋制、盐制等"
- required: true
- default: ""
- - name: process
- type: "string"
- description:
- zh: "具体炮制工艺流程"
- required: true
- default: ""
- - name: effectChange
- type: "string"
- description:
- zh: "炮制对药效的影响"
- required: true
- default: ""
- - name: application
- type: "string"
- description:
- zh: "适用病症或方剂"
- required: true
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的中药炮制专家,请从文本中提取药物的不同炮制方法及其对药效的影响。
- rules:
- zh: |
- 1. 识别文本中提到的所有药物及其炮制方法
- 2. 提取每种炮制方法的名称
- 3. 提取每种炮制方法的具体工艺流程
- 4. 提取炮制对药效的影响
- 5. 常用炮制方法:蜜炙、酒炒、醋制、盐制、炒、煅等
- 6. 每种炮制方法作为独立条目提取
- 7. 保持炮制方法描述与原文一致
-
-display:
- label: "{herbName} - {methodName}"
diff --git a/hyperextract/templates/presets/tcm/pulse_tongue_record.yaml b/hyperextract/templates/presets/tcm/pulse_tongue_record.yaml
deleted file mode 100644
index 0357b92..0000000
--- a/hyperextract/templates/presets/tcm/pulse_tongue_record.yaml
+++ /dev/null
@@ -1,64 +0,0 @@
-name: "PulseTongueRecord"
-autotype: list
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "舌脉特征提取 - 结构化提取舌象(质、苔)与脉象描述,用于统计分析"
-
-item_schema:
- fields:
- - name: type
- type: "string"
- description:
- zh: "特征类型:舌象、脉象"
- required: true
- default: ""
- - name: subType
- type: "string"
- description:
- zh: "子类型:如舌质、舌苔、脉位、脉率、脉势等"
- required: true
- default: ""
- - name: feature
- type: "string"
- description:
- zh: "具体特征描述,如淡红、薄白、浮、沉、迟、数等"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "详细描述"
- required: false
- default: ""
- - name: clinicalSignificance
- type: "string"
- description:
- zh: "临床意义"
- required: false
- default: ""
- - name: source
- type: "string"
- description:
- zh: "来源,如医案名称、章节等"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的中医诊断专家,请从文本中提取舌象和脉象的特征信息。
- rules:
- zh: |
- 1. 提取所有舌象特征,包括舌质(颜色、形态)、舌苔(颜色、厚薄、干湿等)
- 2. 提取所有脉象特征,包括脉位(浮、沉)、脉率(迟、数)、脉势(有力、无力)等
- 3. 为每个特征指定类型和子类型
- 4. 保持特征描述与原文一致
- 5. 舌象描述解析:文言舌象常采用连写表述(如"舌淡红苔薄白"→拆分为舌质淡红、舌苔薄白)
- 6. 脉象术语理解:文言脉象术语需准确识别(如"浮紧脉"→浮脉、紧脉)
- 7. 复合特征拆分:文言中常将多个特征合并描述,需分别提取到对应字段
-
-display:
- label: "{type} - {subType}"
diff --git a/hyperextract/templates/presets/tcm/syndrome_reasoning_graph.yaml b/hyperextract/templates/presets/tcm/syndrome_reasoning_graph.yaml
deleted file mode 100644
index e282208..0000000
--- a/hyperextract/templates/presets/tcm/syndrome_reasoning_graph.yaml
+++ /dev/null
@@ -1,98 +0,0 @@
-name: "SyndromeReasoningGraph"
-autotype: hypergraph
-tag: [tcm]
-
-language: zh
-
-description:
- zh: "辨证论治逻辑图 - 建模 {症状群} -> 证型 -> 治则 -> {处方} 的完整推理链条"
-
-node_schema:
- fields:
- - name: name
- type: "string"
- description:
- zh: "实体名称,如症状、证型、治则、药物等"
- required: true
- default: ""
- - name: category
- type: "string"
- description:
- zh: "实体类型:症状、证型、治则、药物"
- required: true
- default: ""
- - name: description
- type: "string"
- description:
- zh: "简要描述"
- required: false
- default: ""
-
-edge_schema:
- fields:
- - name: nodes
- type: "array"
- description:
- zh: "参与推理的节点列表:[症状1, 症状2, ..., 证型, 治则, 药物1, 药物2, ...]"
- required: true
- default: ""
- - name: reasoningType
- type: "string"
- description:
- zh: "推理类型:辨证论治、随证加减"
- required: true
- default: ""
- - name: reasoningProcess
- type: "string"
- description:
- zh: "推理过程描述"
- required: false
- default: ""
- - name: source
- type: "string"
- description:
- zh: "推理来源,如医案名称、章节等"
- required: false
- default: ""
-
-guide:
- target:
- zh: |
- 你是一位专业的中医辨证论治专家,请从文本中提取中医实体和辨证论治推理逻辑作为超边。
- rules:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 仅从已知实体列表中提取边,不要创建未列出的实体
- 4. 症状:临床表现,如发热、汗出、恶风
- 5. 证型:疾病分类,如太阳中风、太阳伤寒
- 6. 治则:治疗原则,如解肌发表、调和营卫
- 7. 药物:中药名称,如桂枝、麻黄、杏仁
- 8. 推理类型:辨证论治、随证加减
- 9. 推理链条:症状群 → 证型 → 治则 → 处方
- rules_for_nodes:
- zh: |
- 1. 每个节点只能对应一个独立的实体,禁止将多个实体合并为一个节点
- 2. 实体名称与原文保持一致
- 3. 症状:临床表现,如发热、汗出、恶风
- 4. 证型:疾病分类,如太阳中风、太阳伤寒
- 5. 治则:治疗原则,如解肌发表、调和营卫
- 6. 药物:中药名称,如桂枝、麻黄、杏仁
- rules_for_edges:
- zh: |
- 1. 仅从已知实体列表中提取边,不要创建未列出的实体
- 2. 关系描述应与原文保持一致
- 3. 推理类型:辨证论治、随证加减
- 4. 推理链条:症状群 → 证型 → 治则 → 处方
-
-identifiers:
- node_id: "name"
- edge_id: "{reasoningType}|{nodes}"
- edge_members: "nodes"
-
-options:
- extraction_mode: "two_stage"
-
-display:
- node_label: "{name} ({category})"
- edge_label: "{reasoningType}"
diff --git "a/hyperextract/templates/\347\237\245\350\257\206\346\250\241\346\235\277\350\256\276\350\256\241\346\214\207\345\215\227.md" "b/hyperextract/templates/\347\237\245\350\257\206\346\250\241\346\235\277\350\256\276\350\256\241\346\214\207\345\215\227.md"
index 8448ebe..93e4ea1 100644
--- "a/hyperextract/templates/\347\237\245\350\257\206\346\250\241\346\235\277\350\256\276\350\256\241\346\214\207\345\215\227.md"
+++ "b/hyperextract/templates/\347\237\245\350\257\206\346\250\241\346\235\277\350\256\276\350\256\241\346\214\207\345\215\227.md"
@@ -2,7 +2,7 @@
本文档为 Hyper-Extract 知识模板的 YAML 配置提供系统化的设计指导,帮助开发者创建高质量、可维护的模板配置。
----
+***
## 目录
@@ -14,7 +14,7 @@
6. [最佳实践](#6-最佳实践)
7. [常见模式参考](#7-常见模式参考)
----
+***
## 1. 概述
@@ -22,7 +22,7 @@
知识模板是 Hyper-Extract 系统中用于定义结构化信息提取规则的配置文件。通过声明式的 YAML 格式,开发者可以定义:
-- **数据结构**:提取结果的 Schema 定义
+- **数据结构**:提取结果的输出定义
- **提取逻辑**:LLM 应该从文本中提取什么
- **标识规则**:如何唯一识别实体和关系
- **展示方式**:结果如何呈现给用户
@@ -34,6 +34,7 @@ YAML(YAML Ain't Markup Language)是一种人类可读的数据序列化格
**参考文档**:[YAML 官方文档](https://yaml.org/)
**基本特点**:
+
- 使用缩进表示层级关系
- 键值对使用 `key: value` 格式
- 数组使用 `-` 开头
@@ -45,9 +46,9 @@ YAML(YAML Ain't Markup Language)是一种人类可读的数据序列化格
┌─────────────────────────────────────────────────────────────┐
│ YAML 配置文件 │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────────┐ │
-│ │ name │ │ autotype│ │ schema │ │ guide│ │
-│ │ tag │ │ language│ │ ... │ │ identifiers │ │
-│ │ ... │ │ │ │ │ │ display │ │
+│ │language │ │ name │ │ type │ │ tags │ │
+│ │ ... │ │ │ │ │ │ identifiers │ │
+│ │ │ │ │ │ │ │ display │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
@@ -71,16 +72,19 @@ YAML(YAML Ain't Markup Language)是一种人类可读的数据序列化格
```yaml
# language: zh 时(单语言)
# 描述字段直接书写,不需要额外的 zh: 键
-name: EarningsCallSummary
language: zh
-description: "财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标"
+name: EarningsCallSummary
+type: model
+tags: [finance]
+description: '财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标'
-schema:
+output:
+ description: '财报电话会议的结构化摘要'
fields:
- name: company_name
type: string
- description: "公司名称"
+ description: '公司名称'
```
**多语言情况**:当需要支持多语言时,才需要使用语言键格式:
@@ -95,107 +99,105 @@ description:
### 1.5 支持的 AutoType 类型
-| 类型 | YAML 值 | 说明 |
-|------|---------|------|
-| AutoModel | `model` | 提取单个结构化对象 |
-| AutoList | `list` | 提取对象列表 |
-| AutoSet | `set` | 提取去重实体集合 |
-| AutoGraph | `graph` | 简单二元关系图谱 |
-| AutoHypergraph | `hypergraph` | 复杂多元关系图谱 |
-| AutoTemporalGraph | `temporal_graph` | 时序图谱 |
-| AutoSpatialGraph | `spatial_graph` | 空间图谱 |
-| AutoSpatioTemporalGraph | `spatio_temporal_graph` | 时空图谱 |
+| 类型 | YAML 值 | 说明 |
+| ----------------------- | ----------------------- | --------- |
+| AutoModel | `model` | 提取单个结构化对象 |
+| AutoList | `list` | 提取对象列表 |
+| AutoSet | `set` | 提取去重实体集合 |
+| AutoGraph | `graph` | 简单二元关系图谱 |
+| AutoHypergraph | `hypergraph` | 复杂多元关系图谱 |
+| AutoTemporalGraph | `temporal_graph` | 时序图谱 |
+| AutoSpatialGraph | `spatial_graph` | 空间图谱 |
+| AutoSpatioTemporalGraph | `spatio_temporal_graph` | 时空图谱 |
----
+***
## 2. 快速入门
### 2.1 最简配置 (AutoModel)
```yaml
-# 最简单的 model 类型配置
-name: MyTemplate
-autotype: model
-tag: [general]
-
language: zh
-description: "模板简短描述"
+name: MyTemplate
+type: model
+tags: [general]
+description: '模板简短描述'
-schema:
+output:
+ description: '输出结构描述'
fields:
- name: field_name
type: string
- description: "字段描述"
-
-guide:
- target: "你是一位专家,请从文本中提取信息。"
+ description: '字段描述'
- rules: |
- 1. 提取规则1
- 2. 提取规则2
+guideline:
+ target: '你是一位专家,请从文本中提取信息。'
+ rules:
+ - '提取规则1'
+ - '提取规则2'
display:
- label: "field_name"
+ label: 'field_name'
```
### 2.2 完整配置示例 (AutoGraph)
```yaml
-name: MyKnowledgeGraph
-autotype: graph
-tag: [domain_name]
-
language: zh
-description: "知识图谱描述"
-
-node_schema:
- fields:
- - name: name
- type: string
- description: "实体名称"
- - name: category
- type: string
- description: "实体类别"
-
-edge_schema:
- fields:
- - name: source
- type: string
- description: "源实体"
- - name: target
- type: string
- description: "目标实体"
- - name: relationType
- type: string
- description: "关系类型"
-
-guide:
- target: "你是一位领域专家,请从文本中提取知识图谱关系。"
-
- rules_for_nodes: |
- 1. 节点提取规则
-
- rules_for_edges: |
- 1. 边提取规则
+name: MyKnowledgeGraph
+type: graph
+tags: [domain_name]
+description: '知识图谱描述'
+
+output:
+ description: '知识图谱的数据结构定义'
+ entities:
+ description: '实体定义'
+ fields:
+ - name: name
+ type: string
+ description: '实体名称'
+ - name: category
+ type: string
+ description: '实体类别'
+ relations:
+ description: '关系定义'
+ fields:
+ - name: source
+ type: string
+ description: '源实体'
+ - name: target
+ type: string
+ description: '目标实体'
+ - name: relationType
+ type: string
+ description: '关系类型'
+
+guideline:
+ target: '你是一位领域专家,请从文本中提取知识图谱关系。'
+ rules_for_entities:
+ - '实体提取规则'
+ rules_for_relations:
+ - '关系提取规则'
identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
+ entity_id: 'name'
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: 'source'
+ target: 'target'
options:
extraction_mode: two_stage
display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
```
----
+***
## 3. 配置字段详解
@@ -203,25 +205,63 @@ display:
以下字段是所有模板都必须配置的:
-| 字段 | 说明 | 示例 |
-|------|------|------|
-| `name` | 模板类名,唯一标识 | `EarningsCallSummary` |
-| `autotype` | 模板类型 | `model`, `graph`, `list` 等 |
-| `tag` | 领域标签数组 | `[finance]`, `[medicine, tcm]` |
-| `language` | 语言代码 | `zh` |
-| `description` | 模板描述 | 简要说明模板用途 |
+| 字段 | 说明 | 示例 |
+| ------------- | --------- | ------------------------------ |
+| `language` | 语言代码 | `zh` |
+| `name` | 模板类名,唯一标识 | `EarningsCallSummary` |
+| `type` | 模板类型 | `model`, `graph`, `list` 等 |
+| `tags` | 领域标签数组 | `[finance]`, `[medicine, tcm]` |
+| `description` | 模板描述 | 简要说明模板用途 |
### 3.2 其他字段说明
以下字段的具体配置请参考各 AutoType 类型章节:
-| 字段 | 说明 |
-|------|------|
-| `schema` / `item_schema` / `node_schema` / `edge_schema` | 数据结构定义 |
-| `guide` | 提取指南 |
-| `identifiers` | 标识配置 |
-| `options` | 运行时参数 |
-| `display` | 展示配置 |
+| 字段 | 说明 |
+| -------------------------- | ------ |
+| `output` | 输出定义 |
+| `output.entities` | 实体定义 |
+| `output.relations` | 关系定义 |
+| `guideline` | 提取指南 |
+| `identifiers` | 标识配置 |
+| `options` | 运行时参数 |
+| `display` | 展示配置 |
+
+### 3.3 Output 配置说明
+
+`output` 字段用于定义输出数据结构,根据 AutoType 类型有不同的配置方式:
+
+#### 3.3.1 非图类型(model/list/set)
+
+```yaml
+output:
+ description: '输出结构描述'
+ fields:
+ - name: field_name
+ type: string
+ description: '字段描述'
+ required: true
+ default: ''
+```
+
+#### 3.3.2 图类型(graph/hypergraph等)
+
+```yaml
+output:
+ description: '输出结构描述'
+ entities:
+ description: '实体定义描述'
+ fields:
+ - name: name
+ type: string
+ description: '实体名称'
+ relations:
+ description: '关系定义描述'
+ fields:
+ - name: source
+ type: string
+ description: '源实体'
+```
### 3.4 Options 配置说明
@@ -231,26 +271,26 @@ display:
合并策略用于定义当检测到重复实体时如何处理。有以下预定义策略可供选择:
-| 策略 | YAML值 | 说明 |
-|------|--------|------|
-| MERGE_FIELD | `merge_field` | 非空值覆盖,列表追加(默认) |
-| KEEP_INCOMING | `keep_incoming` | 最新数据胜出 |
-| KEEP_EXISTING | `keep_existing` | 保留首次数据 |
-| LLM.BALANCED | `llm_balanced` | LLM智能平衡(默认) |
-| LLM.PREFER_INCOMING | `llm_prefer_incoming` | 偏向新数据 |
-| LLM.PREFER_EXISTING | `llm_prefer_existing` | 偏向旧数据 |
+| 策略 | YAML值 | 说明 |
+| -------------------- | --------------------- | -------------- |
+| MERGE\_FIELD | `merge_field` | 非空值覆盖,列表追加(默认) |
+| KEEP\_INCOMING | `keep_incoming` | 最新数据胜出 |
+| KEEP\_EXISTING | `keep_existing` | 保留首次数据 |
+| LLM.BALANCED | `llm_balanced` | LLM智能平衡(默认) |
+| LLM.PREFER\_INCOMING | `llm_prefer_incoming` | 偏向新数据 |
+| LLM.PREFER\_EXISTING | `llm_prefer_existing` | 偏向旧数据 |
**不同 AutoType 的策略参数名**:
-| AutoType | 参数名 | 示例 |
-|----------|--------|------|
-| AutoModel | `merge_strategy` | `merge_strategy: llm_balanced` |
-| AutoList | - | 无(列表类型不需要合并) |
-| AutoSet | `merge_strategy` | `merge_strategy: keep_incoming` |
-| AutoGraph/AutoHypergraph | `node_merge_strategy` + `edge_merge_strategy` | `node_merge_strategy: llm_balanced`<br>`edge_merge_strategy: merge_field` |
-| AutoTemporalGraph | `node_merge_strategy` + `edge_merge_strategy` | 同上 |
-| AutoSpatialGraph | `node_merge_strategy` + `edge_merge_strategy` | 同上 |
-| AutoSpatioTemporalGraph | `node_merge_strategy` + `edge_merge_strategy` | 同上 |
+| AutoType | 参数名 | 示例 |
+| ------------------------ | --------------------------------------------- | ------------------------------------------------------------------- |
+| AutoModel | `merge_strategy` | `merge_strategy: llm_balanced` |
+| AutoList | - | 无(列表类型不需要合并) |
+| AutoSet | `merge_strategy` | `merge_strategy: keep_incoming` |
+| AutoGraph/AutoHypergraph | `entity_merge_strategy` + `relation_merge_strategy` | `entity_merge_strategy: llm_balanced`<br>`relation_merge_strategy: merge_field` |
+| AutoTemporalGraph | `entity_merge_strategy` + `relation_merge_strategy` | 同上 |
+| AutoSpatialGraph | `entity_merge_strategy` + `relation_merge_strategy` | 同上 |
+| AutoSpatioTemporalGraph | `entity_merge_strategy` + `relation_merge_strategy` | 同上 |
**示例配置**:
@@ -261,54 +301,56 @@ options:
# Graph 类型
options:
- node_merge_strategy: llm_balanced
- edge_merge_strategy: merge_field
+ entity_merge_strategy: llm_balanced
+ relation_merge_strategy: merge_field
```
#### 3.4.2 其他 Options 配置
-| 参数 | 类型 | 默认值 | 说明 |
-|------|------|--------|------|
-| `extraction_mode` | str | `two_stage` | 提取模式:`one_stage` 或 `two_stage` |
-| `chunk_size` | int | `2048` | 文本分块大小 |
-| `chunk_overlap` | int | `256` | 分块重叠大小 |
-| `max_workers` | int | `10` | 最大工作线程数 |
-| `verbose` | bool | `false` | 是否输出详细信息 |
+| 参数 | 类型 | 默认值 | 说明 |
+| ----------------- | ---- | ----------- | ------------------------------ |
+| `extraction_mode` | str | `two_stage` | 提取模式:`one_stage` 或 `two_stage` |
+| `chunk_size` | int | `2048` | 文本分块大小 |
+| `chunk_overlap` | int | `256` | 分块重叠大小 |
+| `max_workers` | int | `10` | 最大工作线程数 |
+| `verbose` | bool | `false` | 是否输出详细信息 |
**时序图专用参数**:
-| `observation_time` | str | - | 观察时间点 |
+\| `observation_time` | str | - | 观察时间点 |
**空间图专用参数**:
-| `observation_location` | str | - | 观察位置 |
+\| `observation_location` | str | - | 观察位置 |
### 3.5 Rules 字段格式说明
-`guide` 中的 `rules`、`rules_for_nodes`、`rules_for_edges`、`rules_for_time`、`rules_for_location` 等字段使用 List 格式:
+`guideline` 中的 `rules`、`rules_for_entities`、`rules_for_relations`、`rules_for_time`、`rules_for_location` 等字段使用 List 格式:
```yaml
rules:
- - "提取规则1"
- - "提取规则2"
+ - '提取规则1'
+ - '提取规则2'
```
解析时会自动转换为有序编号字符串:
+
```
1. 提取规则1
2. 提取规则2
```
**多语言情况**:
+
```yaml
rules:
zh:
- - "中文规则1"
- - "中文规则2"
+ - '中文规则1'
+ - '中文规则2'
en:
- - "English rule 1"
- - "English rule 2"
+ - 'English rule 1'
+ - 'English rule 2'
```
----
+***
## 4. 多语言配置指南
@@ -317,16 +359,19 @@ rules:
当 `language` 设置为单一语言(如 `zh`)时,描述字段直接书写:
```yaml
-name: EarningsCallSummary
language: zh
+name: EarningsCallSummary
+type: model
+tags: [finance]
-description: "财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标"
+description: '财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标'
-schema:
+output:
+ description: '财报电话会议的结构化摘要'
fields:
- name: company_name
type: string
- description: "公司名称"
+ description: '公司名称'
```
### 4.2 多语言格式
@@ -336,144 +381,157 @@ schema:
```yaml
language: zh
+name: EarningsCallSummary
+type: model
+tags: [finance]
description:
- zh: "中文描述"
- en: "English description"
+ zh: '中文描述'
+ en: 'English description'
-schema:
+output:
+ description:
+ zh: '财报电话会议的结构化摘要'
+ en: 'Structured summary of earnings call'
fields:
- name: company_name
type: string
description:
- zh: "公司名称"
- en: "Company name"
+ zh: '公司名称'
+ en: 'Company name'
```
----
+***
## 5. AutoType 类型指南
### 5.1 AutoType 类型概览表
-| 类型 | 值 | Schema | Identifiers | Extraction Guide | Display |
-|------|------|--------|-------------|-------------------|---------|
-| AutoModel | `model` | `schema` | - | target, rules | label |
-| AutoList | `list` | `item_schema` | - | target, rules | label |
-| AutoSet | `set` | `item_schema` | item_id | target, rules | label |
-| AutoGraph | `graph` | node_schema + edge_schema | node_id, edge_id, edge_members | target, rules_for_nodes, rules_for_edges | node_label + edge_label |
-| AutoHypergraph | `hypergraph` | node_schema + edge_schema | node_id, edge_id, edge_members | target, rules_for_nodes, rules_for_edges | node_label + edge_label |
-| AutoTemporalGraph | `temporal_graph` | node_schema + edge_schema | + time_field | target, rules_for_nodes, rules_for_edges, rules_for_time | node_label + edge_label |
-| AutoSpatialGraph | `spatial_graph` | node_schema + edge_schema | + location_field | target, rules_for_nodes, rules_for_edges, rules_for_location | node_label + edge_label |
-| AutoSpatioTemporalGraph | `spatio_temporal_graph` | node_schema + edge_schema | + time_field + location_field | target, rules_for_nodes, rules_for_edges, rules_for_time, rules_for_location | node_label + edge_label |
+| 类型 | 值 | Output | Identifiers | Guideline | Display |
+| ----------------------- | ----------------------- | --------------------------- | --------------------------------- | ------------------------------------------------------------------------------------ | ------------------------- |
+| AutoModel | `model` | `output` | - | target, rules | label |
+| AutoList | `list` | `output` | - | target, rules | label |
+| AutoSet | `set` | `output` | item\_id | target, rules | label |
+| AutoGraph | `graph` | entities + relations | entity\_id, relation\_id, relation\_members | target, rules\_for\_entities, rules\_for\_relations | entity\_label + relation\_label |
+| AutoHypergraph | `hypergraph` | entities + relations | entity\_id, relation\_id, relation\_members | target, rules\_for\_entities, rules\_for\_relations | entity\_label + relation\_label |
+| AutoTemporalGraph | `temporal_graph` | entities + relations | + time\_field | target, rules\_for\_entities, rules\_for\_relations, rules\_for\_time | entity\_label + relation\_label |
+| AutoSpatialGraph | `spatial_graph` | entities + relations | + location\_field | target, rules\_for\_entities, rules\_for\_relations, rules\_for\_location | entity\_label + relation\_label |
+| AutoSpatioTemporalGraph | `spatio_temporal_graph` | entities + relations | + time\_field + location\_field | target, rules\_for\_entities, rules\_for\_relations, rules\_for\_time, rules\_for\_location | entity\_label + relation\_label |
### 5.2 AutoModel - 结构化模型
用于提取单个结构化对象,包含多个字段。
-**schema 定义**:
+**output 定义**:
+
```yaml
-schema:
+output:
+ description: '输出结构描述'
fields:
- name: company_name
type: string
- description: "公司名称"
+ description: '公司名称'
required: true
- default: ""
+ default: ''
- name: revenue
type: string
- description: "营收金额"
+ description: '营收金额'
required: false
- default: "N/A"
+ default: 'N/A'
```
-**guide 编写**:
-```yaml
-guide:
- target: "你是一位财务分析师,请从财报中提取关键信息。"
+**guideline 编写**:
+```yaml
+guideline:
+ target: '你是一位财务分析师,请从财报中提取关键信息。'
rules:
- - "每个字段对应一个独立的信息项"
- - "数据与原文保持一致"
+ - '每个字段对应一个独立的信息项'
+ - '数据与原文保持一致'
```
**display 配置**:
+
```yaml
display:
- label: "{company_name}"
+ label: '{company_name}'
```
**完整示例**:
-```yaml
-name: EarningsCallSummary
-autotype: model
-tag: [finance]
+```yaml
language: zh
-description: "财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标"
+name: EarningsCallSummary
+type: model
+tags: [finance]
+description: '财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标'
-schema:
+output:
+ description: '财报电话会议的结构化摘要'
fields:
- name: company_name
type: string
- description: "公司名称"
+ description: '公司名称'
- name: revenue
type: string
- description: "营收金额"
-
-guide:
- target: "你是一位财务分析师,请从财报中提取关键信息。"
+ description: '营收金额'
+guideline:
+ target: '你是一位财务分析师,请从财报中提取关键信息。'
rules:
- - "每个字段对应一个独立的信息项"
- - "数据与原文保持一致"
+ - '每个字段对应一个独立的信息项'
+ - '数据与原文保持一致'
display:
- label: "{company_name}"
+ label: '{company_name}'
```
### 5.3 AutoList - 列表
用于提取对象列表,每个对象结构相同。
-**item_schema 定义**:
+**output 定义**:
+
```yaml
-item_schema:
+output:
+ description: '关键词列表'
fields:
- name: term
type: string
- description: "关键词"
+ description: '关键词'
- name: frequency
type: int
- description: "出现频次"
+ description: '出现频次'
```
**display 配置**:
+
```yaml
display:
label: term
```
**完整示例**:
-```yaml
-name: KeywordList
-autotype: list
+```yaml
language: zh
-description: "关键词列表 - 从文本中提取所有关键词"
+name: KeywordList
+type: list
+tags: [general]
+description: '关键词列表 - 从文本中提取所有关键词'
-item_schema:
+output:
+ description: '关键词列表'
fields:
- name: term
type: string
- description: "关键词"
-
-guide:
- target: "你是一位关键词提取专家"
+ description: '关键词'
+guideline:
+ target: '你是一位关键词提取专家'
rules:
- - "提取文本中的所有关键词"
+ - '提取文本中的所有关键词'
display:
label: term
@@ -483,37 +541,39 @@ display:
用于提取去重实体集合。
-**item_schema 定义**:同 AutoList
+**output 定义**:同 AutoList
**identifiers 配置**:
+
```yaml
identifiers:
item_id: name
```
**完整示例**:
-```yaml
-name: EntityRegistry
-autotype: set
+```yaml
language: zh
-description: "实体注册表 - 从文本中提取所有实体并去重"
+name: EntityRegistry
+type: set
+tags: [general]
+description: '实体注册表 - 从文本中提取所有实体并去重'
-item_schema:
+output:
+ description: '实体注册表'
fields:
- name: name
type: string
- description: "实体名称"
+ description: '实体名称'
- name: category
type: string
- description: "实体类型"
-
-guide:
- target: "你是一位实体识别专家"
+ description: '实体类型'
+guideline:
+ target: '你是一位实体识别专家'
rules:
- - "提取所有实体并去重"
+ - '提取所有实体并去重'
identifiers:
item_id: name
@@ -526,62 +586,69 @@ display:
用于提取实体和它们之间的二元关系。
-**node_schema 定义**:
+**output.entities 定义**:
+
```yaml
-node_schema:
- fields:
- - name: name
- type: string
- description: "实体名称"
- - name: category
- type: string
- description: "实体类别"
+output:
+ entities:
+ description: '实体定义'
+ fields:
+ - name: name
+ type: string
+ description: '实体名称'
+ - name: category
+ type: string
+ description: '实体类别'
```
-**edge_schema 定义**:
+**output.relations 定义**:
+
```yaml
-edge_schema:
- fields:
- - name: source
- type: string
- description: "源实体"
- - name: target
- type: string
- description: "目标实体"
- - name: relationType
- type: string
- description: "关系类型"
+output:
+ relations:
+ description: '关系定义'
+ fields:
+ - name: source
+ type: string
+ description: '源实体'
+ - name: target
+ type: string
+ description: '目标实体'
+ - name: relationType
+ type: string
+ description: '关系类型'
```
**identifiers 配置**:
+
```yaml
identifiers:
- node_id: name
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
+ entity_id: name
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
source: source
target: target
```
-**guide 编写**:
-```yaml
-guide:
- target: "你是一位知识图谱专家,请从文本中提取实体关系。"
-
- rules_for_nodes:
- - "实体名称与原文保持一致"
- - "每个实体必须有明确的类别"
+**guideline 编写**:
- rules_for_edges:
- - "source 和 target 都必须是已知节点"
- - "relationType 必须是预定义的关系类型"
+```yaml
+guideline:
+ target: '你是一位知识图谱专家,请从文本中提取实体关系。'
+ rules_for_entities:
+ - '实体名称与原文保持一致'
+ - '每个实体必须有明确的类别'
+ rules_for_relations:
+ - 'source 和 target 都必须是已知节点'
+ - 'relationType 必须是预定义的关系类型'
```
**display 配置**:
+
```yaml
display:
- node_label: "{name} ({category})"
- edge_label: "{relationType}"
+ entity_label: '{name} ({category})'
+ relation_label: '{relationType}'
```
### 5.6 AutoHypergraph - 复杂多元关系图谱
@@ -589,35 +656,40 @@ display:
用于建模多个实体之间的复杂关联关系。
**与 AutoGraph 的区别**:
+
- AutoGraph 是**二元关系**:每条边连接两个节点
- AutoHypergraph 是**多元关系**:一条边可以连接任意数量的节点
-**edge_schema 定义**:
+**output.relations 定义**:
+
```yaml
-edge_schema:
- fields:
- - name: mechanism_name
- type: string
- description: "机制名称"
- - name: participating_entities
- type: array
- description: "参与的实体列表"
- - name: relationType
- type: string
- description: "关系类型"
- - name: outcome
- type: string
- description: "结果"
+output:
+ relations:
+ description: '关系定义'
+ fields:
+ - name: mechanism_name
+ type: string
+ description: '机制名称'
+ - name: participating_entities
+ type: array
+ description: '参与的实体列表'
+ - name: relationType
+ type: string
+ description: '关系类型'
+ - name: outcome
+ type: string
+ description: '结果'
```
**identifiers 配置**:
+
```yaml
identifiers:
- node_id: "name"
- edge_id: "mechanism_name"
- edge_members:
- source: "participating_entities"
- target: "outcome"
+ entity_id: 'name'
+ relation_id: 'mechanism_name'
+ relation_members:
+ source: 'participating_entities'
+ target: 'outcome'
```
### 5.7 AutoTemporalGraph - 时序图谱
@@ -625,29 +697,32 @@ identifiers:
用于提取带有时间信息的实体关系。
**特有 identifiers 配置**:
+
```yaml
identifiers:
- node_id: "name"
- edge_id: "{source}|{relationType}|{target}"
- edge_members:
- source: "source"
- target: "target"
- time_field: "fiscal_period"
+ entity_id: 'name'
+ relation_id: '{source}|{relationType}|{target}'
+ relation_members:
+ source: 'source'
+ target: 'target'
+ time_field: 'fiscal_period'
```
-**特有 guide 编写**:
+**特有 guideline 编写**:
+
```yaml
-guide:
+guideline:
rules_for_time:
- - "当前观察日期:{observation_time}"
+ - '当前观察日期:{observation_time}'
- "'去年' → {observation_time} 的前一年"
```
**特有 options 配置**:
+
```yaml
options:
- extraction_mode: "two_stage"
- observation_time: "2024-01-01"
+ extraction_mode: 'two_stage'
+ observation_time: '2024-01-01'
```
### 5.8 AutoSpatialGraph - 空间图谱
@@ -655,23 +730,26 @@ options:
用于提取带有位置信息的实体关系。
**特有 identifiers 配置**:
+
```yaml
identifiers:
- location_field: "location"
+ location_field: 'location'
```
-**特有 guide 编写**:
+**特有 guideline 编写**:
+
```yaml
-guide:
+guideline:
rules_for_location:
- - "当前观察位置:{observation_location}"
+ - '当前观察位置:{observation_location}'
- "'这里' → {observation_location}"
```
**特有 options 配置**:
+
```yaml
options:
- observation_location: "北京"
+ observation_location: '北京'
```
### 5.9 AutoSpatioTemporalGraph - 时空图谱
@@ -679,18 +757,19 @@ options:
综合 AutoTemporalGraph 和 AutoSpatialGraph 的所有配置。
**同时包含**:
+
- `time_field` + `rules_for_time` + `observation_time`
- `location_field` + `rules_for_location` + `observation_location`
----
+***
## 6. 最佳实践
### 6.1 命名规范
- **name**: 使用 PascalCase,如 `EarningsCallSummary`
-- **tag**: 使用小写,如 `[finance]`, `[medicine]`
-- **字段名**: 使用 snake_case,如 `company_name`, `fiscal_period`
+- **tags**: 使用小写,如 `[finance]`, `[medicine]`
+- **字段名**: 使用 snake\_case,如 `company_name`, `fiscal_period`
- **关系类型**: 使用中文,如 `拥有`、`影响`
### 6.2 description 撰写
@@ -700,32 +779,34 @@ options:
- 说明提取目标
**示例**:
+
```yaml
-description: "财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标"
+description: '财报电话会议摘要 - 从财报电话会议记录中提取关键财务指标'
```
### 6.3 测试验证
创建模板后,建议:
+
1. 使用真实文本测试提取效果
2. 检查字段覆盖是否完整
3. 验证边节点关系是否正确
4. 确认时间/位置解析是否准确
----
+***
## 7. 常见模式参考
-| 模式 | AutoType | 示例文件 |
-|------|----------|----------|
-| 财报摘要 | AutoModel | `earnings_call_summary.yaml` |
+| 模式 | AutoType | 示例文件 |
+| ------ | ----------------- | ------------------------------------ |
+| 财报摘要 | AutoModel | `earnings_call_summary.yaml` |
| 财务时序图谱 | AutoTemporalGraph | `financial_data_temporal_graph.yaml` |
-| 病理超图 | AutoHypergraph | `pathology_hypergraph.yaml` |
-| 关键词列表 | AutoList | `keyword_list.yaml` |
-| 实体注册表 | AutoSet | `entity_registry.yaml` |
-| 经络流注图 | AutoGraph | `meridian_flow_graph.yaml` |
+| 病理超图 | AutoHypergraph | `pathology_hypergraph.yaml` |
+| 关键词列表 | AutoList | `keyword_list.yaml` |
+| 实体注册表 | AutoSet | `entity_registry.yaml` |
+| 经络流注图 | AutoGraph | `meridian_flow_graph.yaml` |
----
+***
## 附录
diff --git a/hyperextract/utils/template_engine/__init__.py b/hyperextract/utils/template_engine/__init__.py
index 2c86c38..9c8f7e8 100644
--- a/hyperextract/utils/template_engine/__init__.py
+++ b/hyperextract/utils/template_engine/__init__.py
@@ -1,37 +1,43 @@
-"""Template Engine - Automatically generate templates from YAML configuration.
+"""Template Engine - Dynamically creates knowledge extraction templates from YAML configuration.
-This module provides functionality to dynamically generate HyperExtract templates from YAML configuration files.
-
-Usage:
- # Recommended: use Template class
- from hyperextract.utils import Template
-
- Template.list()
- Template.search("知识图谱")
- template = Template.create("knowledge_graph")
-
- # Advanced: use Gallery and Factory directly
- from hyperextract.utils.template_engine import Gallery, TemplateFactory
+Main Components:
+- Template: Unified API for template operations
+- Gallery: Template library management
+- TemplateFactory: Creates template instances from configuration
+- TemplateConfig: Configuration model
+- ConfigLoader: Loads YAML configuration
+- SchemaBuilder: Dynamically generates Pydantic Schema
+- PromptBuilder: Builds extraction prompts
+- IdentifierResolver: Resolves identifier extractors
"""
from .template import Template
from .gallery import Gallery
-from .factory import TemplateFactory
+from .factory import TemplateFactory, TemplateWrapper
from .builder import (
TemplateConfig,
ConfigLoader,
SchemaBuilder,
PromptBuilder,
IdentifierResolver,
+ OptionsBuilder,
)
+from .builder.prompt import Guideline
+from .builder.schema import OutputDefinition, FieldsDefinition
+
__all__ = [
"Template",
"Gallery",
"TemplateFactory",
+ "TemplateWrapper",
"TemplateConfig",
"ConfigLoader",
"SchemaBuilder",
"PromptBuilder",
"IdentifierResolver",
+ "OptionsBuilder",
+ "Guideline",
+ "OutputDefinition",
+ "FieldsDefinition",
]
diff --git a/hyperextract/utils/template_engine/builder/identifiers.py b/hyperextract/utils/template_engine/builder/identifiers.py
index 5677926..89bca42 100644
--- a/hyperextract/utils/template_engine/builder/identifiers.py
+++ b/hyperextract/utils/template_engine/builder/identifiers.py
@@ -8,15 +8,15 @@ class Identifiers(BaseModel):
"""Identifier configuration."""
item_id: Optional[str] = None
- node_id: Optional[str] = None
- edge_id: Optional[str] = None
- edge_members: Optional[Union[str, Dict[str, str], List[str]]] = None
+ entity_id: Optional[str] = None
+ relation_id: Optional[str] = None
+ relation_members: Optional[Union[str, Dict[str, str], List[str]]] = None
time_field: Optional[str] = None
location_field: Optional[str] = None
class IdentifierResolver:
- """Identifier Resolver - Generates extraction functions for nodes and edges."""
+ """Identifier Resolver - Generates extraction functions for entities and relations."""
@staticmethod
def resolve_item_id(field_name: str) -> Callable[[BaseModel], str]:
@@ -27,59 +27,59 @@ class IdentifierResolver:
return extractor
@staticmethod
- def resolve_node_id(field_name: str) -> Callable[[BaseModel], str]:
- """Generate node ID extractor."""
- def extractor(node: BaseModel) -> str:
- value = getattr(node, field_name, None)
+ def resolve_entity_id(field_name: str) -> Callable[[BaseModel], str]:
+ """Generate entity ID extractor."""
+ def extractor(entity: BaseModel) -> str:
+ value = getattr(entity, field_name, None)
return str(value) if value is not None else ""
return extractor
@staticmethod
- def resolve_edge_id(template: str) -> Callable[[BaseModel], str]:
- """Generate edge ID extractor (supports template string)."""
- def extractor(edge: BaseModel) -> str:
+ def resolve_relation_id(template: str) -> Callable[[BaseModel], str]:
+ """Generate relation ID extractor (supports template string)."""
+ def extractor(relation: BaseModel) -> str:
try:
- return template.format(**edge.model_dump())
+ return template.format(**relation.model_dump())
except (KeyError, ValueError):
parts = []
for key in template.split("|"):
key = key.strip().strip("{}")
- value = getattr(edge, key, None)
+ value = getattr(relation, key, None)
parts.append(str(value) if value is not None else "")
return "|".join(parts)
return extractor
@staticmethod
- def resolve_edge_members(
- edge_members: Union[str, Dict[str, str], List[str]]
+ def resolve_relation_members(
+ relation_members: Union[str, Dict[str, str], List[str]]
) -> Callable[[BaseModel], Tuple[str, ...]]:
- """Generate edge member extractor (unified for binary edge/hyperedge)."""
- if isinstance(edge_members, str):
- def extractor(edge: BaseModel) -> Tuple[str, ...]:
- value = getattr(edge, edge_members, None)
+ """Generate relation member extractor (unified for binary relation/hyperrelation)."""
+ if isinstance(relation_members, str):
+ def extractor(relation: BaseModel) -> Tuple[str, ...]:
+ value = getattr(relation, relation_members, None)
if value is None:
return ()
if isinstance(value, (list, tuple)):
return tuple(str(v) for v in value)
return (str(value),)
return extractor
- elif isinstance(edge_members, dict):
- source_key = edge_members.get("source", "source")
- target_key = edge_members.get("target", "target")
+ elif isinstance(relation_members, dict):
+ source_key = relation_members.get("source", "source")
+ target_key = relation_members.get("target", "target")
- def extractor(edge: BaseModel) -> Tuple[str, str]:
- source = getattr(edge, source_key, None)
- target = getattr(edge, target_key, None)
+ def extractor(relation: BaseModel) -> Tuple[str, str]:
+ source = getattr(relation, source_key, None)
+ target = getattr(relation, target_key, None)
return (
str(source) if source is not None else "",
str(target) if target is not None else "",
)
return extractor
- elif isinstance(edge_members, list):
- def extractor(edge: BaseModel) -> Tuple[str, ...]:
+ elif isinstance(relation_members, list):
+ def extractor(relation: BaseModel) -> Tuple[str, ...]:
result = []
- for field_name in edge_members:
- value = getattr(edge, field_name, None)
+ for field_name in relation_members:
+ value = getattr(relation, field_name, None)
if value is None:
continue
if isinstance(value, (list, tuple)):
@@ -89,7 +89,7 @@ class IdentifierResolver:
return tuple(result)
return extractor
else:
- raise ValueError(f"Invalid edge_members configuration: {edge_members}")
+ raise ValueError(f"Invalid relation_members configuration: {relation_members}")
@staticmethod
def resolve_time(field_name: str) -> Callable[[BaseModel], str]:
@@ -112,9 +112,8 @@ class IdentifierResolver:
"""Resolve all identifier extractors based on configuration."""
result = {}
identifiers = config.identifiers or {}
- autotype = config.autotype
+ autotype = config.type
- # Handle Identifiers object or dict
if hasattr(identifiers, 'model_dump'):
identifiers_dict = identifiers.model_dump()
elif isinstance(identifiers, dict):
@@ -126,22 +125,22 @@ class IdentifierResolver:
result["item_id_extractor"] = cls.resolve_item_id(identifiers_dict["item_id"])
if autotype in ("graph", "hypergraph", "temporal_graph", "spatial_graph", "spatio_temporal_graph"):
- if identifiers_dict.get("node_id"):
- result["node_key_extractor"] = cls.resolve_node_id(identifiers_dict["node_id"])
+ if identifiers_dict.get("entity_id"):
+ result["entity_key_extractor"] = cls.resolve_entity_id(identifiers_dict["entity_id"])
- if identifiers_dict.get("edge_id"):
- result["edge_key_extractor"] = cls.resolve_edge_id(identifiers_dict["edge_id"])
+ if identifiers_dict.get("relation_id"):
+ result["relation_key_extractor"] = cls.resolve_relation_id(identifiers_dict["relation_id"])
- if identifiers_dict.get("edge_members"):
- result["nodes_in_edge_extractor"] = cls.resolve_edge_members(identifiers_dict["edge_members"])
+ if identifiers_dict.get("relation_members"):
+ result["entities_in_relation_extractor"] = cls.resolve_relation_members(identifiers_dict["relation_members"])
if autotype in ("temporal_graph", "spatio_temporal_graph"):
if identifiers_dict.get("time_field"):
- result["time_in_edge_extractor"] = cls.resolve_time(identifiers_dict["time_field"])
+ result["time_in_relation_extractor"] = cls.resolve_time(identifiers_dict["time_field"])
if autotype in ("spatial_graph", "spatio_temporal_graph"):
if identifiers_dict.get("location_field"):
- result["location_in_edge_extractor"] = cls.resolve_location(identifiers_dict["location_field"])
+ result["location_in_relation_extractor"] = cls.resolve_location(identifiers_dict["location_field"])
return result
diff --git a/hyperextract/utils/template_engine/builder/loader.py b/hyperextract/utils/template_engine/builder/loader.py
index d477691..6f0e1a6 100644
--- a/hyperextract/utils/template_engine/builder/loader.py
+++ b/hyperextract/utils/template_engine/builder/loader.py
@@ -5,9 +5,9 @@ from pathlib import Path
from typing import Any, Dict, List, Literal, Optional, Union
from pydantic import BaseModel, Field, field_validator, ConfigDict
-from .prompt import Guide
+from .prompt import Guideline
from .identifiers import Identifiers
-from .schema import ModelSchema, ItemSchema, NodeSchema, EdgeSchema
+from .schema import ModelSchema, ItemSchema, NodeSchema, EdgeSchema, OutputDefinition
from .options import Options
@@ -15,26 +15,27 @@ class Display(BaseModel):
"""Display configuration."""
label: Optional[str] = None
- node_label: Optional[str] = None
- edge_label: Optional[str] = None
+ entity_label: Optional[str] = None
+ relation_label: Optional[str] = None
class TemplateConfig(BaseModel):
"""Template configuration top-level model."""
+ language: Optional[Union[str, List[str]]] = "zh"
name: str
- autotype: Literal[
+ type: Literal[
"model", "list", "set", "graph", "hypergraph",
"temporal_graph", "spatial_graph", "spatio_temporal_graph"
]
- tag: Optional[List[str]] = None
- language: Optional[Union[str, List[str]]] = "zh"
+ tags: Optional[List[str]] = None
description: Optional[Union[str, Dict[str, str]]] = None
+ output: Optional[OutputDefinition] = None
model_schema: Optional[ModelSchema] = Field(None, alias="schema")
item_schema: Optional[ItemSchema] = None
node_schema: Optional[NodeSchema] = None
edge_schema: Optional[EdgeSchema] = None
- guide: Optional[Guide] = None
+ guideline: Optional[Guideline] = None
identifiers: Optional[Identifiers] = None
options: Optional[Options] = None
display: Optional[Display] = None
@@ -91,13 +92,13 @@ class ConfigLoader:
return None
@staticmethod
- def validate_autotype(autotype: str) -> bool:
- """Validate if autotype is valid."""
+ def validate_type(type_value: str) -> bool:
+ """Validate if type is valid."""
valid_types = {
"model", "list", "set", "graph", "hypergraph",
"temporal_graph", "spatial_graph", "spatio_temporal_graph"
}
- return autotype in valid_types
+ return type_value in valid_types
__all__ = [
diff --git a/hyperextract/utils/template_engine/builder/options.py b/hyperextract/utils/template_engine/builder/options.py
index 34ca285..9cbbea1 100644
--- a/hyperextract/utils/template_engine/builder/options.py
+++ b/hyperextract/utils/template_engine/builder/options.py
@@ -10,11 +10,11 @@ from .identifiers import IdentifierResolver
class Options(BaseModel):
- """运行时选项配置 - 排除 LLM、Embedder、Schema、Prompt 之外的所有配置"""
+ """Runtime options configuration - excludes LLM, Embedder, Schema, Prompt."""
merge_strategy: Optional[str] = None
- node_merge_strategy: Optional[str] = None
- edge_merge_strategy: Optional[str] = None
+ entity_merge_strategy: Optional[str] = None
+ relation_merge_strategy: Optional[str] = None
extraction_mode: Optional[str] = None
observation_time: Optional[str] = None
observation_location: Optional[str] = None
@@ -22,13 +22,13 @@ class Options(BaseModel):
chunk_overlap: int = 256
max_workers: int = 10
verbose: bool = False
- search_fields: Optional[List[str]] = None
- node_search_fields: Optional[List[str]] = None
- edge_search_fields: Optional[List[str]] = None
+ fields_for_search: Optional[List[str]] = None
+ entity_fields_for_search: Optional[List[str]] = None
+ relation_fields_for_search: Optional[List[str]] = None
def get_merge_strategy(self) -> Optional[str]:
"""Get merge strategy."""
- return self.merge_strategy or self.node_merge_strategy
+ return self.merge_strategy or self.entity_merge_strategy
class ModelOptions:
@@ -89,24 +89,24 @@ class GraphOptions:
def __init__(
self,
extraction_mode: str = "two_stage",
- node_merge_strategy: str = "llm_balanced",
- edge_merge_strategy: str = "llm_balanced",
+ entity_merge_strategy: str = "llm_balanced",
+ relation_merge_strategy: str = "llm_balanced",
chunk_size: int = 2048,
chunk_overlap: int = 256,
max_workers: int = 10,
verbose: bool = False,
- node_search_fields: Optional[List[str]] = None,
- edge_search_fields: Optional[List[str]] = None,
+ entity_fields_for_search: Optional[List[str]] = None,
+ relation_fields_for_search: Optional[List[str]] = None,
):
self.extraction_mode = extraction_mode
- self.node_merge_strategy = node_merge_strategy
- self.edge_merge_strategy = edge_merge_strategy
+ self.entity_merge_strategy = entity_merge_strategy
+ self.relation_merge_strategy = relation_merge_strategy
self.chunk_size = chunk_size
self.chunk_overlap = chunk_overlap
self.max_workers = max_workers
self.verbose = verbose
- self.node_search_fields = node_search_fields
- self.edge_search_fields = edge_search_fields
+ self.entity_fields_for_search = entity_fields_for_search
+ self.relation_fields_for_search = relation_fields_for_search
class TemporalGraphOptions(GraphOptions):
@@ -115,26 +115,26 @@ class TemporalGraphOptions(GraphOptions):
def __init__(
self,
extraction_mode: str = "two_stage",
- node_merge_strategy: str = "llm_balanced",
- edge_merge_strategy: str = "llm_balanced",
+ entity_merge_strategy: str = "llm_balanced",
+ relation_merge_strategy: str = "llm_balanced",
observation_time: Optional[str] = None,
chunk_size: int = 2048,
chunk_overlap: int = 256,
max_workers: int = 10,
verbose: bool = False,
- node_search_fields: Optional[List[str]] = None,
- edge_search_fields: Optional[List[str]] = None,
+ entity_fields_for_search: Optional[List[str]] = None,
+ relation_fields_for_search: Optional[List[str]] = None,
):
super().__init__(
extraction_mode=extraction_mode,
- node_merge_strategy=node_merge_strategy,
- edge_merge_strategy=edge_merge_strategy,
+ entity_merge_strategy=entity_merge_strategy,
+ relation_merge_strategy=relation_merge_strategy,
chunk_size=chunk_size,
chunk_overlap=chunk_overlap,
max_workers=max_workers,
verbose=verbose,
- node_search_fields=node_search_fields,
- edge_search_fields=edge_search_fields,
+ entity_fields_for_search=entity_fields_for_search,
+ relation_fields_for_search=relation_fields_for_search,
)
self.observation_time = observation_time
@@ -145,26 +145,26 @@ class SpatialGraphOptions(GraphOptions):
def __init__(
self,
extraction_mode: str = "two_stage",
- node_merge_strategy: str = "llm_balanced",
- edge_merge_strategy: str = "llm_balanced",
+ entity_merge_strategy: str = "llm_balanced",
+ relation_merge_strategy: str = "llm_balanced",
observation_location: Optional[str] = None,
chunk_size: int = 2048,
chunk_overlap: int = 256,
max_workers: int = 10,
verbose: bool = False,
- node_search_fields: Optional[List[str]] = None,
- edge_search_fields: Optional[List[str]] = None,
+ entity_fields_for_search: Optional[List[str]] = None,
+ relation_fields_for_search: Optional[List[str]] = None,
):
super().__init__(
extraction_mode=extraction_mode,
- node_merge_strategy=node_merge_strategy,
- edge_merge_strategy=edge_merge_strategy,
+ entity_merge_strategy=entity_merge_strategy,
+ relation_merge_strategy=relation_merge_strategy,
chunk_size=chunk_size,
chunk_overlap=chunk_overlap,
max_workers=max_workers,
verbose=verbose,
- node_search_fields=node_search_fields,
- edge_search_fields=edge_search_fields,
+ entity_fields_for_search=entity_fields_for_search,
+ relation_fields_for_search=relation_fields_for_search,
)
self.observation_location = observation_location
@@ -175,34 +175,34 @@ class SpatioTemporalGraphOptions(TemporalGraphOptions):
def __init__(
self,
extraction_mode: str = "two_stage",
- node_merge_strategy: str = "llm_balanced",
- edge_merge_strategy: str = "llm_balanced",
+ entity_merge_strategy: str = "llm_balanced",
+ relation_merge_strategy: str = "llm_balanced",
observation_time: Optional[str] = None,
observation_location: Optional[str] = None,
chunk_size: int = 2048,
chunk_overlap: int = 256,
max_workers: int = 10,
verbose: bool = False,
- node_search_fields: Optional[List[str]] = None,
- edge_search_fields: Optional[List[str]] = None,
+ entity_fields_for_search: Optional[List[str]] = None,
+ relation_fields_for_search: Optional[List[str]] = None,
):
super().__init__(
extraction_mode=extraction_mode,
- node_merge_strategy=node_merge_strategy,
- edge_merge_strategy=edge_merge_strategy,
+ entity_merge_strategy=entity_merge_strategy,
+ relation_merge_strategy=relation_merge_strategy,
observation_time=observation_time,
chunk_size=chunk_size,
chunk_overlap=chunk_overlap,
max_workers=max_workers,
verbose=verbose,
- node_search_fields=node_search_fields,
- edge_search_fields=edge_search_fields,
+ entity_fields_for_search=entity_fields_for_search,
+ relation_fields_for_search=relation_fields_for_search,
)
self.observation_location = observation_location
class OptionsBuilder:
- """Options Builder - 负责选项解析、验证、merge strategy 解析"""
+ """Options Builder - handles option parsing, validation, merge strategy resolution."""
@staticmethod
def get_language(config) -> str:
@@ -241,7 +241,12 @@ class OptionsBuilder:
f"Invalid merge strategy '{strategy_name}'. "
f"Valid options: {OptionsBuilder.VALID_MERGE_STRATEGIES}"
)
- if '.' in strategy_name:
+ # 处理下划线格式,转换为点格式
+ if '_' in strategy_name and '.' not in strategy_name:
+ parts = strategy_name.split('_')
+ if len(parts) == 2 and parts[0] in ['llm']:
+ return getattr(getattr(MergeStrategy, parts[0].upper()), parts[1].upper())
+ elif '.' in strategy_name:
parts = strategy_name.split('.')
return getattr(getattr(MergeStrategy, parts[0].upper()), parts[1].upper())
else:
@@ -290,14 +295,14 @@ class OptionsBuilder:
extraction_mode = cls.get_extraction_mode(config)
return GraphOptions(
extraction_mode=extraction_mode,
- node_merge_strategy=options.node_merge_strategy or "llm_balanced",
- edge_merge_strategy=options.edge_merge_strategy or "llm_balanced",
+ entity_merge_strategy=options.entity_merge_strategy or "llm_balanced",
+ relation_merge_strategy=options.relation_merge_strategy or "llm_balanced",
chunk_size=options.chunk_size,
chunk_overlap=options.chunk_overlap,
max_workers=options.max_workers,
verbose=options.verbose,
- node_search_fields=options.node_search_fields,
- edge_search_fields=options.edge_search_fields,
+ entity_fields_for_search=options.entity_fields_for_search,
+ relation_fields_for_search=options.relation_fields_for_search,
)
@classmethod
@@ -307,15 +312,15 @@ class OptionsBuilder:
extraction_mode = cls.get_extraction_mode(config)
return TemporalGraphOptions(
extraction_mode=extraction_mode,
- node_merge_strategy=options.node_merge_strategy or "llm_balanced",
- edge_merge_strategy=options.edge_merge_strategy or "llm_balanced",
+ entity_merge_strategy=options.entity_merge_strategy or "llm_balanced",
+ relation_merge_strategy=options.relation_merge_strategy or "llm_balanced",
observation_time=options.observation_time,
chunk_size=options.chunk_size,
chunk_overlap=options.chunk_overlap,
max_workers=options.max_workers,
verbose=options.verbose,
- node_search_fields=options.node_search_fields,
- edge_search_fields=options.edge_search_fields,
+ entity_fields_for_search=options.entity_fields_for_search,
+ relation_fields_for_search=options.relation_fields_for_search,
)
@classmethod
@@ -325,15 +330,15 @@ class OptionsBuilder:
extraction_mode = cls.get_extraction_mode(config)
return SpatialGraphOptions(
extraction_mode=extraction_mode,
- node_merge_strategy=options.node_merge_strategy or "llm_balanced",
- edge_merge_strategy=options.edge_merge_strategy or "llm_balanced",
+ entity_merge_strategy=options.entity_merge_strategy or "llm_balanced",
+ relation_merge_strategy=options.relation_merge_strategy or "llm_balanced",
observation_location=options.observation_location,
chunk_size=options.chunk_size,
chunk_overlap=options.chunk_overlap,
max_workers=options.max_workers,
verbose=options.verbose,
- node_search_fields=options.node_search_fields,
- edge_search_fields=options.edge_search_fields,
+ entity_fields_for_search=options.entity_fields_for_search,
+ relation_fields_for_search=options.relation_fields_for_search,
)
@classmethod
@@ -343,105 +348,105 @@ class OptionsBuilder:
extraction_mode = cls.get_extraction_mode(config)
return SpatioTemporalGraphOptions(
extraction_mode=extraction_mode,
- node_merge_strategy=options.node_merge_strategy or "llm_balanced",
- edge_merge_strategy=options.edge_merge_strategy or "llm_balanced",
+ entity_merge_strategy=options.entity_merge_strategy or "llm_balanced",
+ relation_merge_strategy=options.relation_merge_strategy or "llm_balanced",
observation_time=options.observation_time,
observation_location=options.observation_location,
chunk_size=options.chunk_size,
chunk_overlap=options.chunk_overlap,
max_workers=options.max_workers,
verbose=options.verbose,
- node_search_fields=options.node_search_fields,
- edge_search_fields=options.edge_search_fields,
+ entity_fields_for_search=options.entity_fields_for_search,
+ relation_fields_for_search=options.relation_fields_for_search,
)
@classmethod
def build_prompts(cls, config, prompt_builder, extraction_mode: str = None):
- """Build prompts based on extraction mode and autotype."""
+ """Build prompts based on extraction mode and type."""
if extraction_mode is None:
extraction_mode = cls.get_extraction_mode(config)
- guide = config.guide
- autotype = config.autotype
+ guideline = config.guideline
+ autotype = config.type
if autotype in ("model", "list", "set"):
- return prompt_builder.build_model_prompt(guide), "", ""
+ return prompt_builder.build_model_prompt(guideline), "", ""
if autotype == "graph":
if extraction_mode == "one_stage":
return (
- prompt_builder.build_graph_main_prompt(guide),
+ prompt_builder.build_graph_main_prompt(guideline),
"",
"",
)
else:
return (
"",
- prompt_builder.build_graph_node_prompt(guide),
- prompt_builder.build_graph_edge_prompt(guide),
+ prompt_builder.build_graph_entity_prompt(guideline),
+ prompt_builder.build_graph_relation_prompt(guideline),
)
if autotype in ("hypergraph",):
if extraction_mode == "one_stage":
return (
- prompt_builder.build_graph_main_prompt(guide),
+ prompt_builder.build_graph_main_prompt(guideline),
"",
"",
)
else:
return (
"",
- prompt_builder.build_graph_node_prompt(guide),
- prompt_builder.build_graph_edge_prompt(guide),
+ prompt_builder.build_graph_entity_prompt(guideline),
+ prompt_builder.build_graph_relation_prompt(guideline),
)
if autotype == "temporal_graph":
if extraction_mode == "one_stage":
return (
- prompt_builder.build_graph_main_prompt(guide),
+ prompt_builder.build_graph_main_prompt(guideline),
"",
"",
)
else:
return (
"",
- prompt_builder.build_temporal_graph_node_prompt(guide),
- prompt_builder.build_graph_edge_prompt(guide),
+ prompt_builder.build_temporal_graph_entity_prompt(guideline),
+ prompt_builder.build_graph_relation_prompt(guideline),
)
if autotype == "spatial_graph":
if extraction_mode == "one_stage":
return (
- prompt_builder.build_graph_main_prompt(guide),
+ prompt_builder.build_graph_main_prompt(guideline),
"",
"",
)
else:
return (
"",
- prompt_builder.build_spatial_graph_node_prompt(guide),
- prompt_builder.build_graph_edge_prompt(guide),
+ prompt_builder.build_spatial_graph_entity_prompt(guideline),
+ prompt_builder.build_graph_relation_prompt(guideline),
)
if autotype == "spatio_temporal_graph":
if extraction_mode == "one_stage":
return (
- prompt_builder.build_graph_main_prompt(guide),
+ prompt_builder.build_graph_main_prompt(guideline),
"",
"",
)
else:
return (
"",
- prompt_builder.build_spatio_temporal_graph_node_prompt(guide),
- prompt_builder.build_graph_edge_prompt(guide),
+ prompt_builder.build_spatio_temporal_graph_entity_prompt(guideline),
+ prompt_builder.build_graph_relation_prompt(guideline),
)
return "", "", ""
@classmethod
def validate_model_config(cls, config):
- """验证 AutoModel 配置"""
+ """Validate AutoModel configuration."""
schema_dict = SchemaBuilder.build_schema(config)
if schema_dict.get("schema") is None:
raise ValueError(f"AutoModel requires schema definition: {config.name}")
@@ -449,7 +454,7 @@ class OptionsBuilder:
@classmethod
def validate_list_config(cls, config):
- """验证 AutoList 配置"""
+ """Validate AutoList configuration."""
schema_dict = SchemaBuilder.build_schema(config)
if schema_dict.get("item_schema") is None:
raise ValueError(f"AutoList requires item_schema definition: {config.name}")
@@ -457,7 +462,7 @@ class OptionsBuilder:
@classmethod
def validate_set_config(cls, config):
- """验证 AutoSet 配置"""
+ """Validate AutoSet configuration."""
schema_dict = SchemaBuilder.build_schema(config)
if schema_dict.get("item_schema") is None:
raise ValueError(f"AutoSet requires item_schema definition: {config.name}")
@@ -470,13 +475,13 @@ class OptionsBuilder:
@classmethod
def validate_graph_config(cls, config):
- """验证 AutoGraph/AutoHypergraph 配置"""
+ """Validate AutoGraph/AutoHypergraph configuration."""
schema_dict = SchemaBuilder.build_schema(config)
- if schema_dict.get("node_schema") is None or schema_dict.get("edge_schema") is None:
- raise ValueError(f"AutoGraph requires node_schema and edge_schema definition: {config.name}")
+ if schema_dict.get("entity_schema") is None or schema_dict.get("relation_schema") is None:
+ raise ValueError(f"AutoGraph requires entity_schema and relation_schema definition: {config.name}")
identifiers = IdentifierResolver.resolve_all(config)
- required = ["node_key_extractor", "edge_key_extractor", "nodes_in_edge_extractor"]
+ required = ["entity_key_extractor", "relation_key_extractor", "entities_in_relation_extractor"]
if not all(identifiers.get(k) for k in required):
raise ValueError(f"AutoGraph requires complete identifiers configuration: {config.name}")
@@ -484,30 +489,30 @@ class OptionsBuilder:
@classmethod
def validate_temporal_graph_config(cls, config):
- """验证 AutoTemporalGraph 配置"""
+ """Validate AutoTemporalGraph configuration."""
schema_dict, identifiers = cls.validate_graph_config(config)
- if identifiers.get("time_in_edge_extractor") is None:
+ if identifiers.get("time_in_relation_extractor") is None:
raise ValueError(f"AutoTemporalGraph requires time_field in identifiers: {config.name}")
return schema_dict, identifiers
@classmethod
def validate_spatial_graph_config(cls, config):
- """验证 AutoSpatialGraph 配置"""
+ """Validate AutoSpatialGraph configuration."""
schema_dict, identifiers = cls.validate_graph_config(config)
- if identifiers.get("location_extractor") is None:
+ if identifiers.get("location_in_relation_extractor") is None:
raise ValueError(f"AutoSpatialGraph requires location_field in identifiers: {config.name}")
return schema_dict, identifiers
@classmethod
def validate_spatio_temporal_graph_config(cls, config):
- """验证 AutoSpatioTemporalGraph 配置"""
+ """Validate AutoSpatioTemporalGraph configuration."""
schema_dict, identifiers = cls.validate_graph_config(config)
- if not identifiers.get("time_extractor") or not identifiers.get("location_extractor"):
+ if not identifiers.get("time_in_relation_extractor") or not identifiers.get("location_in_relation_extractor"):
raise ValueError(f"AutoSpatioTemporalGraph requires time_field and location_field in identifiers: {config.name}")
return schema_dict, identifiers
diff --git a/hyperextract/utils/template_engine/builder/prompt.py b/hyperextract/utils/template_engine/builder/prompt.py
index fe89d9a..4311f08 100644
--- a/hyperextract/utils/template_engine/builder/prompt.py
+++ b/hyperextract/utils/template_engine/builder/prompt.py
@@ -1,17 +1,17 @@
"""Extraction models and prompt builder."""
-from typing import Any, Callable, Dict, List, Optional, Tuple, Union
+from typing import Dict, List, Optional, Union
from pydantic import BaseModel
-class GuideTarget(BaseModel):
+class GuidelineTarget(BaseModel):
"""Extraction target with role definition and content description."""
zh: Optional[str] = None
en: Optional[str] = None
@classmethod
- def from_value(cls, value: Union[str, Dict[str, str], None]) -> Optional["GuideTarget"]:
+ def from_value(cls, value: Union[str, Dict[str, str], None]) -> Optional["GuidelineTarget"]:
"""Create instance from string or dict."""
if value is None:
return None
@@ -26,13 +26,13 @@ class GuideTarget(BaseModel):
return getattr(self, language) or self.zh or ""
-class Guide(BaseModel):
- """Guide configuration."""
+class Guideline(BaseModel):
+ """Extraction guideline configuration."""
target: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
rules: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
- rules_for_nodes: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
- rules_for_edges: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
+ rules_for_entities: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
+ rules_for_relations: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
rules_for_time: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
rules_for_location: Optional[Union[str, List[str], Dict[str, Union[str, List[str]]]]] = None
@@ -61,8 +61,8 @@ LABEL_MAPPING = {
"source_text": "源文本",
"known_entities": "已知实体",
"extraction_rules": "提取规则",
- "node_extraction_rules": "节点提取规则",
- "edge_extraction_rules": "边提取规则",
+ "entity_extraction_rules": "实体提取规则",
+ "relation_extraction_rules": "关系提取规则",
"time_rules": "时间规则",
"location_rules": "位置规则",
"role_and_task": "角色与任务",
@@ -71,8 +71,8 @@ LABEL_MAPPING = {
"source_text": "Source Text",
"known_entities": "Known Entities",
"extraction_rules": "Extraction Rules",
- "node_extraction_rules": "Node Extraction Rules",
- "edge_extraction_rules": "Edge Extraction Rules",
+ "entity_extraction_rules": "Entity Extraction Rules",
+ "relation_extraction_rules": "Relation Extraction Rules",
"time_rules": "Time Rules",
"location_rules": "Location Rules",
"role_and_task": "Role and Task",
@@ -112,57 +112,57 @@ class PromptBuilder:
title = self.labels.get(title_key, title_key)
return f"### {title}\n{text}"
- def build_target(self, guide: Guide) -> Optional[str]:
+ def build_target(self, guideline: Guideline) -> Optional[str]:
"""Build target field (role definition + extraction content description)."""
- target = guide.target
+ target = guideline.target
if target is None:
return None
return self._get_text(target, self.language)
- def build_rules(self, guide: Guide) -> Optional[str]:
+ def build_rules(self, guideline: Guideline) -> Optional[str]:
"""Build rules field (with title)."""
- rules = self._get_text(guide.rules, self.language)
+ rules = self._get_text(guideline.rules, self.language)
if rules:
return self._add_title(rules, "extraction_rules")
return None
- def build_rules_for_nodes(self, guide: Guide) -> Optional[str]:
- """Build rules_for_nodes field (with title)."""
- rules = self._get_text(guide.rules_for_nodes, self.language)
+ def build_rules_for_entities(self, guideline: Guideline) -> Optional[str]:
+ """Build rules_for_entities field (with title)."""
+ rules = self._get_text(guideline.rules_for_entities, self.language)
if rules:
- return self._add_title(rules, "node_extraction_rules")
+ return self._add_title(rules, "entity_extraction_rules")
return None
- def build_rules_for_edges(self, guide: Guide) -> Optional[str]:
- """Build rules_for_edges field (with title)."""
- rules = self._get_text(guide.rules_for_edges, self.language)
+ def build_rules_for_relations(self, guideline: Guideline) -> Optional[str]:
+ """Build rules_for_relations field (with title)."""
+ rules = self._get_text(guideline.rules_for_relations, self.language)
if rules:
- return self._add_title(rules, "edge_extraction_rules")
+ return self._add_title(rules, "relation_extraction_rules")
return None
- def build_rules_for_time(self, guide: Guide) -> Optional[str]:
+ def build_rules_for_time(self, guideline: Guideline) -> Optional[str]:
"""Build rules_for_time field (with title)."""
- rules = self._get_text(guide.rules_for_time, self.language)
+ rules = self._get_text(guideline.rules_for_time, self.language)
if rules:
return self._add_title(rules, "time_rules")
return None
- def build_rules_for_location(self, guide: Guide) -> Optional[str]:
+ def build_rules_for_location(self, guideline: Guideline) -> Optional[str]:
"""Build rules_for_location field (with title)."""
- rules = self._get_text(guide.rules_for_location, self.language)
+ rules = self._get_text(guideline.rules_for_location, self.language)
if rules:
return self._add_title(rules, "location_rules")
return None
- def build_model_prompt(self, guide: Guide) -> str:
+ def build_model_prompt(self, guideline: Guideline) -> str:
"""Build Model/List/Set type Prompt."""
parts = []
- target = self.build_target(guide)
+ target = self.build_target(guideline)
if target:
parts.append(target)
- rules = self.build_rules(guide)
+ rules = self.build_rules(guideline)
if rules:
parts.append(rules)
@@ -171,55 +171,55 @@ class PromptBuilder:
return "\n\n".join(parts)
- def build_graph_main_prompt(self, guide: Guide) -> str:
+ def build_graph_main_prompt(self, guideline: Guideline) -> str:
"""Build Graph type main Prompt (single-stage mode)."""
parts = []
- target = self.build_target(guide)
+ target = self.build_target(guideline)
if target:
parts.append(target)
- rules_for_nodes = self.build_rules_for_nodes(guide)
- if rules_for_nodes:
- parts.append(rules_for_nodes)
+ rules_for_entities = self.build_rules_for_entities(guideline)
+ if rules_for_entities:
+ parts.append(rules_for_entities)
- rules_for_edges = self.build_rules_for_edges(guide)
- if rules_for_edges:
- parts.append(rules_for_edges)
+ rules_for_relations = self.build_rules_for_relations(guideline)
+ if rules_for_relations:
+ parts.append(rules_for_relations)
source_label = self.labels.get("source_text", "源文本")
parts.append(f"## {source_label}:\n{{source_text}}")
return "\n\n".join(parts)
- def build_graph_node_prompt(self, guide: Guide) -> str:
- """Build Graph type node extraction Prompt (two-stage mode)."""
+ def build_graph_entity_prompt(self, guideline: Guideline) -> str:
+ """Build Graph type entity extraction Prompt (two-stage mode)."""
parts = []
- target = self.build_target(guide)
+ target = self.build_target(guideline)
if target:
parts.append(target)
- rules_for_nodes = self.build_rules_for_nodes(guide)
- if rules_for_nodes:
- parts.append(rules_for_nodes)
+ rules_for_entities = self.build_rules_for_entities(guideline)
+ if rules_for_entities:
+ parts.append(rules_for_entities)
source_label = self.labels.get("source_text", "源文本")
parts.append(f"## {source_label}:\n{{source_text}}")
return "\n\n".join(parts)
- def build_graph_edge_prompt(self, guide: Guide) -> str:
- """Build Graph type edge extraction Prompt (two-stage mode)."""
+ def build_graph_relation_prompt(self, guideline: Guideline) -> str:
+ """Build Graph type relation extraction Prompt (two-stage mode)."""
parts = []
- target = self.build_target(guide)
+ target = self.build_target(guideline)
if target:
parts.append(target)
- rules_for_edges = self.build_rules_for_edges(guide)
- if rules_for_edges:
- parts.append(rules_for_edges)
+ rules_for_relations = self.build_rules_for_relations(guideline)
+ if rules_for_relations:
+ parts.append(rules_for_relations)
known_label = self.labels.get("known_entities", "已知实体")
parts.append(f"## {known_label}:\n{{known_nodes}}")
@@ -229,19 +229,19 @@ class PromptBuilder:
return "\n\n".join(parts)
- def build_temporal_graph_node_prompt(self, guide: Guide) -> str:
- """Build TemporalGraph node extraction Prompt."""
+ def build_temporal_graph_entity_prompt(self, guideline: Guideline) -> str:
+ """Build TemporalGraph entity extraction Prompt."""
parts = []
- target = self.build_target(guide)
+ target = self.build_target(guideline)
if target:
parts.append(target)
- rules_for_nodes = self.build_rules_for_nodes(guide)
- if rules_for_nodes:
- parts.append(rules_for_nodes)
+ rules_for_entities = self.build_rules_for_entities(guideline)
+ if rules_for_entities:
+ parts.append(rules_for_entities)
- rules_for_time = self.build_rules_for_time(guide)
+ rules_for_time = self.build_rules_for_time(guideline)
if rules_for_time:
parts.append(rules_for_time)
@@ -250,19 +250,19 @@ class PromptBuilder:
return "\n\n".join(parts)
- def build_spatial_graph_node_prompt(self, guide: Guide) -> str:
- """Build SpatialGraph node extraction Prompt."""
+ def build_spatial_graph_entity_prompt(self, guideline: Guideline) -> str:
+ """Build SpatialGraph entity extraction Prompt."""
parts = []
- target = self.build_target(guide)
+ target = self.build_target(guideline)
if target:
parts.append(target)
- rules_for_nodes = self.build_rules_for_nodes(guide)
- if rules_for_nodes:
- parts.append(rules_for_nodes)
+ rules_for_entities = self.build_rules_for_entities(guideline)
+ if rules_for_entities:
+ parts.append(rules_for_entities)
- rules_for_location = self.build_rules_for_location(guide)
+ rules_for_location = self.build_rules_for_location(guideline)
if rules_for_location:
parts.append(rules_for_location)
@@ -271,23 +271,23 @@ class PromptBuilder:
return "\n\n".join(parts)
- def build_spatio_temporal_graph_node_prompt(self, guide: Guide) -> str:
- """Build SpatioTemporalGraph node extraction Prompt."""
+ def build_spatio_temporal_graph_entity_prompt(self, guideline: Guideline) -> str:
+ """Build SpatioTemporalGraph entity extraction Prompt."""
parts = []
- target = self.build_target(guide)
+ target = self.build_target(guideline)
if target:
parts.append(target)
- rules_for_nodes = self.build_rules_for_nodes(guide)
- if rules_for_nodes:
- parts.append(rules_for_nodes)
+ rules_for_entities = self.build_rules_for_entities(guideline)
+ if rules_for_entities:
+ parts.append(rules_for_entities)
- rules_for_time = self.build_rules_for_time(guide)
+ rules_for_time = self.build_rules_for_time(guideline)
if rules_for_time:
parts.append(rules_for_time)
- rules_for_location = self.build_rules_for_location(guide)
+ rules_for_location = self.build_rules_for_location(guideline)
if rules_for_location:
parts.append(rules_for_location)
@@ -298,7 +298,7 @@ class PromptBuilder:
__all__ = [
- "GuideTarget",
- "Guide",
+ "GuidelineTarget",
+ "Guideline",
"PromptBuilder",
]
diff --git a/hyperextract/utils/template_engine/builder/schema.py b/hyperextract/utils/template_engine/builder/schema.py
index b4be810..1f7cbea 100644
--- a/hyperextract/utils/template_engine/builder/schema.py
+++ b/hyperextract/utils/template_engine/builder/schema.py
@@ -34,6 +34,22 @@ class SchemaField(BaseModel):
return v
+class FieldsDefinition(BaseModel):
+ """Fields definition container with description."""
+
+ description: Optional[Union[str, Dict[str, str]]] = None
+ fields: List[SchemaField] = Field(default_factory=list)
+
+
+class OutputDefinition(BaseModel):
+ """Output definition - unified data structure definition."""
+
+ description: Optional[Union[str, Dict[str, str]]] = None
+ fields: Optional[List[SchemaField]] = None
+ entities: Optional[FieldsDefinition] = None
+ relations: Optional[FieldsDefinition] = None
+
+
class BaseSchema(BaseModel):
"""Base schema configuration."""
@@ -104,59 +120,92 @@ class SchemaBuilder:
return field.description.get("zh") or field.description.get("en") or ""
return str(field.description)
+ @staticmethod
+ def build_schema_description(description: Optional[Union[str, Dict[str, str]]]) -> str:
+ """Build schema-level description."""
+ if description is None:
+ return ""
+ if isinstance(description, str):
+ return description
+ if isinstance(description, dict):
+ return description.get("zh") or description.get("en") or ""
+ return str(description)
+
@classmethod
- def build_model_schema(cls, schema: ModelSchema) -> Type[BaseModel]:
- """Build Model type Schema."""
- fields = {}
- for field in schema.fields:
+ def _build_schema_from_fields(cls, fields: List[SchemaField]) -> Type[BaseModel]:
+ """Build Pydantic schema from field list."""
+ schema_fields = {}
+ for field in fields:
field_type = cls.build_field_type(field)
default = cls.build_field_default(field)
description = cls.build_field_description(field)
- fields[field.name] = (field_type, Field(default=default, description=description))
+ schema_fields[field.name] = (field_type, Field(default=default, description=description))
+ return create_model("GeneratedSchema", **schema_fields)
- return create_model("GeneratedModelSchema", **fields)
+ @classmethod
+ def build_model_schema(cls, schema: ModelSchema) -> Type[BaseModel]:
+ """Build Model type Schema."""
+ return cls._build_schema_from_fields(schema.fields)
@classmethod
def build_item_schema(cls, schema: ItemSchema) -> Type[BaseModel]:
"""Build List/Set type Item Schema."""
- fields = {}
- for field in schema.fields:
- field_type = cls.build_field_type(field)
- default = cls.build_field_default(field)
- description = cls.build_field_description(field)
- fields[field.name] = (field_type, Field(default=default, description=description))
-
- return create_model("GeneratedItemSchema", **fields)
+ return cls._build_schema_from_fields(schema.fields)
@classmethod
def build_node_schema(cls, schema: NodeSchema) -> Type[BaseModel]:
"""Build Graph type Node Schema."""
- fields = {}
- for field in schema.fields:
- field_type = cls.build_field_type(field)
- default = cls.build_field_default(field)
- description = cls.build_field_description(field)
- fields[field.name] = (field_type, Field(default=default, description=description))
-
- return create_model("GeneratedNodeSchema", **fields)
+ return cls._build_schema_from_fields(schema.fields)
@classmethod
def build_edge_schema(cls, schema: EdgeSchema) -> Type[BaseModel]:
"""Build Graph type Edge Schema."""
- fields = {}
- for field in schema.fields:
- field_type = cls.build_field_type(field)
- default = cls.build_field_default(field)
- description = cls.build_field_description(field)
- fields[field.name] = (field_type, Field(default=default, description=description))
+ return cls._build_schema_from_fields(schema.fields)
- return create_model("GeneratedEdgeSchema", **fields)
+ @classmethod
+ def build_output_schema(cls, output: OutputDefinition) -> Type[BaseModel]:
+ """Build schema from OutputDefinition (for non-graph types)."""
+ if output.fields is None:
+ raise ValueError("OutputDefinition must have fields for non-graph types")
+ model = cls._build_schema_from_fields(output.fields)
+ if output.description:
+ model.__doc__ = cls.build_schema_description(output.description)
+ return model
+
+ @classmethod
+ def build_entity_schema(cls, entities: FieldsDefinition) -> Type[BaseModel]:
+ """Build entity schema from FieldsDefinition."""
+ model = cls._build_schema_from_fields(entities.fields)
+ if entities.description:
+ model.__doc__ = cls.build_schema_description(entities.description)
+ return model
+
+ @classmethod
+ def build_relation_schema(cls, relations: FieldsDefinition) -> Type[BaseModel]:
+ """Build relation schema from FieldsDefinition."""
+ model = cls._build_schema_from_fields(relations.fields)
+ if relations.description:
+ model.__doc__ = cls.build_schema_description(relations.description)
+ return model
@classmethod
def build_schema(cls, config) -> Dict[str, Type[BaseModel]]:
"""Build corresponding Schema based on configuration."""
result = {}
+ if config.output is not None:
+ autotype = config.type
+
+ if autotype in ("model", "list", "set"):
+ if config.output.fields:
+ result["schema"] = cls.build_output_schema(config.output)
+
+ elif autotype in ("graph", "hypergraph", "temporal_graph", "spatial_graph", "spatio_temporal_graph"):
+ if config.output.entities:
+ result["entity_schema"] = cls.build_entity_schema(config.output.entities)
+ if config.output.relations:
+ result["relation_schema"] = cls.build_relation_schema(config.output.relations)
+
if config.model_schema is not None:
result["schema"] = cls.build_model_schema(config.model_schema)
@@ -164,10 +213,10 @@ class SchemaBuilder:
result["item_schema"] = cls.build_item_schema(config.item_schema)
if config.node_schema is not None:
- result["node_schema"] = cls.build_node_schema(config.node_schema)
+ result["entity_schema"] = cls.build_node_schema(config.node_schema)
if config.edge_schema is not None:
- result["edge_schema"] = cls.build_edge_schema(config.edge_schema)
+ result["relation_schema"] = cls.build_edge_schema(config.edge_schema)
return result
@@ -175,6 +224,8 @@ class SchemaBuilder:
__all__ = [
"FieldDescription",
"SchemaField",
+ "FieldsDefinition",
+ "OutputDefinition",
"BaseSchema",
"ModelSchema",
"ItemSchema",
diff --git a/hyperextract/utils/template_engine/factory.py b/hyperextract/utils/template_engine/factory.py
index c314d3b..ba86fa4 100644
--- a/hyperextract/utils/template_engine/factory.py
+++ b/hyperextract/utils/template_engine/factory.py
@@ -15,6 +15,7 @@ from .builder import (
Options,
)
+
if TYPE_CHECKING:
from hyperextract.types import (
AutoModel,
@@ -42,7 +43,7 @@ class TemplateFactory:
return {}
result = {}
- autotype = config.autotype
+ autotype = config.type
display_dict = (
display.model_dump() if hasattr(display, "model_dump") else display
)
@@ -59,16 +60,16 @@ class TemplateFactory:
"spatial_graph",
"spatio_temporal_graph",
):
- node_label_field = display_dict.get("node_label")
- if node_label_field:
- result["node_label_extractor"] = lambda x: str(
- getattr(x, node_label_field, "")
+ entity_label_field = display_dict.get("entity_label")
+ if entity_label_field:
+ result["entity_label_extractor"] = lambda x: str(
+ getattr(x, entity_label_field, "")
)
- edge_label_field = display_dict.get("edge_label")
- if edge_label_field:
- result["edge_label_extractor"] = lambda x: str(
- getattr(x, edge_label_field, "")
+ relation_label_field = display_dict.get("relation_label")
+ if relation_label_field:
+ result["relation_label_extractor"] = lambda x: str(
+ getattr(x, relation_label_field, "")
)
return result
@@ -86,7 +87,7 @@ class TemplateFactory:
schema_class = schema_dict.get("schema")
prompt_builder = PromptBuilder(language)
- prompt = prompt_builder.build_model_prompt(config.guide)
+ prompt = prompt_builder.build_model_prompt(config.guideline)
options = OptionsBuilder.build_model_options(config, language)
@@ -120,7 +121,7 @@ class TemplateFactory:
item_schema_class = schema_dict.get("item_schema")
prompt_builder = PromptBuilder(language)
- prompt = prompt_builder.build_model_prompt(config.guide)
+ prompt = prompt_builder.build_model_prompt(config.guideline)
options = OptionsBuilder.build_list_options(config)
@@ -149,7 +150,7 @@ class TemplateFactory:
item_id_extractor = identifiers.get("item_id_extractor")
prompt_builder = PromptBuilder(language)
- prompt = prompt_builder.build_model_prompt(config.guide)
+ prompt = prompt_builder.build_model_prompt(config.guideline)
options = OptionsBuilder.build_set_options(config, language)
@@ -175,57 +176,58 @@ class TemplateFactory:
def create_graph(
cls, config: TemplateConfig, llm_client: BaseChatModel, embedder: Embeddings
) -> "AutoGraph":
+ """Create AutoGraph template."""
from hyperextract.types import AutoGraph
language = cls.get_language(config)
schema_dict, identifiers = OptionsBuilder.validate_graph_config(config)
- node_schema_class = schema_dict.get("node_schema")
- edge_schema_class = schema_dict.get("edge_schema")
- node_key_extractor = identifiers.get("node_key_extractor")
- edge_key_extractor = identifiers.get("edge_key_extractor")
- nodes_in_edge_extractor = identifiers.get("nodes_in_edge_extractor")
+ entity_schema_class = schema_dict.get("entity_schema")
+ relation_schema_class = schema_dict.get("relation_schema")
+ entity_key_extractor = identifiers.get("entity_key_extractor")
+ relation_key_extractor = identifiers.get("relation_key_extractor")
+ entities_in_relation_extractor = identifiers.get("entities_in_relation_extractor")
prompt_builder = PromptBuilder(language)
options = OptionsBuilder.build_graph_options(config, language)
- prompt, prompt_for_node_extraction, prompt_for_edge_extraction = (
+ prompt, prompt_for_entity_extraction, prompt_for_relation_extraction = (
OptionsBuilder.build_prompts(
config, prompt_builder, options.extraction_mode
)
)
return AutoGraph(
- node_schema=node_schema_class,
- edge_schema=edge_schema_class,
- node_key_extractor=node_key_extractor,
- edge_key_extractor=edge_key_extractor,
- nodes_in_edge_extractor=nodes_in_edge_extractor,
- llm_client=llm_client,
- embedder=embedder,
- extraction_mode=options.extraction_mode,
- node_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.node_merge_strategy,
- node_key_extractor,
- llm_client,
- node_schema_class,
- ),
- edge_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.edge_merge_strategy,
- edge_key_extractor,
- llm_client,
- edge_schema_class,
- ),
- prompt=prompt,
- prompt_for_node_extraction=prompt_for_node_extraction,
- prompt_for_edge_extraction=prompt_for_edge_extraction,
- chunk_size=options.chunk_size,
- chunk_overlap=options.chunk_overlap,
- max_workers=options.max_workers,
- verbose=options.verbose,
- node_fields_for_index=options.node_search_fields,
- edge_fields_for_index=options.edge_search_fields,
- )
+ entity_schema=entity_schema_class,
+ relation_schema=relation_schema_class,
+ entity_key_extractor=entity_key_extractor,
+ relation_key_extractor=relation_key_extractor,
+ entities_in_relation_extractor=entities_in_relation_extractor,
+ llm_client=llm_client,
+ embedder=embedder,
+ extraction_mode=options.extraction_mode,
+ entity_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
+ options.entity_merge_strategy,
+ entity_key_extractor,
+ llm_client,
+ entity_schema_class,
+ ),
+ relation_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
+ options.relation_merge_strategy,
+ relation_key_extractor,
+ llm_client,
+ relation_schema_class,
+ ),
+ prompt=prompt,
+ prompt_for_entity_extraction=prompt_for_entity_extraction,
+ prompt_for_relation_extraction=prompt_for_relation_extraction,
+ chunk_size=options.chunk_size,
+ chunk_overlap=options.chunk_overlap,
+ max_workers=options.max_workers,
+ verbose=options.verbose,
+ entity_fields_for_index=options.entity_fields_for_search,
+ relation_fields_for_index=options.relation_fields_for_search,
+ )
@classmethod
def create_hypergraph(
@@ -244,54 +246,54 @@ class TemplateFactory:
schema_dict, identifiers = OptionsBuilder.validate_temporal_graph_config(
config
)
- node_schema_class = schema_dict.get("node_schema")
- edge_schema_class = schema_dict.get("edge_schema")
- node_key_extractor = identifiers.get("node_key_extractor")
- edge_key_extractor = identifiers.get("edge_key_extractor")
- nodes_in_edge_extractor = identifiers.get("nodes_in_edge_extractor")
- time_in_edge_extractor = identifiers.get("time_in_edge_extractor")
+ entity_schema_class = schema_dict.get("entity_schema")
+ relation_schema_class = schema_dict.get("relation_schema")
+ entity_key_extractor = identifiers.get("entity_key_extractor")
+ relation_key_extractor = identifiers.get("relation_key_extractor")
+ entities_in_relation_extractor = identifiers.get("entities_in_relation_extractor")
+ time_in_relation_extractor = identifiers.get("time_in_relation_extractor")
prompt_builder = PromptBuilder(language)
options = OptionsBuilder.build_temporal_graph_options(config, language)
- prompt, prompt_for_node_extraction, prompt_for_edge_extraction = (
+ prompt, prompt_for_entity_extraction, prompt_for_relation_extraction = (
OptionsBuilder.build_prompts(
config, prompt_builder, options.extraction_mode
)
)
return AutoTemporalGraph(
- node_schema=node_schema_class,
- edge_schema=edge_schema_class,
- node_key_extractor=node_key_extractor,
- edge_key_extractor=edge_key_extractor,
- nodes_in_edge_extractor=nodes_in_edge_extractor,
- time_in_edge_extractor=time_in_edge_extractor,
+ node_schema=entity_schema_class,
+ edge_schema=relation_schema_class,
+ node_key_extractor=entity_key_extractor,
+ edge_key_extractor=relation_key_extractor,
+ nodes_in_edge_extractor=entities_in_relation_extractor,
+ time_in_edge_extractor=time_in_relation_extractor,
observation_time=options.observation_time,
llm_client=llm_client,
embedder=embedder,
extraction_mode=options.extraction_mode,
node_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.node_merge_strategy,
- node_key_extractor,
+ options.entity_merge_strategy,
+ entity_key_extractor,
llm_client,
- node_schema_class,
+ entity_schema_class,
),
edge_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.edge_merge_strategy,
- edge_key_extractor,
+ options.relation_merge_strategy,
+ relation_key_extractor,
llm_client,
- edge_schema_class,
+ relation_schema_class,
),
prompt=prompt,
- prompt_for_node_extraction=prompt_for_node_extraction,
- prompt_for_edge_extraction=prompt_for_edge_extraction,
+ prompt_for_node_extraction=prompt_for_entity_extraction,
+ prompt_for_edge_extraction=prompt_for_relation_extraction,
chunk_size=options.chunk_size,
chunk_overlap=options.chunk_overlap,
max_workers=options.max_workers,
verbose=options.verbose,
- node_fields_for_index=options.node_search_fields,
- edge_fields_for_index=options.edge_search_fields,
+ node_fields_for_index=options.entity_fields_for_search,
+ edge_fields_for_index=options.relation_fields_for_search,
)
@classmethod
@@ -305,54 +307,54 @@ class TemplateFactory:
schema_dict, identifiers = OptionsBuilder.validate_spatial_graph_config(
config
)
- node_schema_class = schema_dict.get("node_schema")
- edge_schema_class = schema_dict.get("edge_schema")
- node_key_extractor = identifiers.get("node_key_extractor")
- edge_key_extractor = identifiers.get("edge_key_extractor")
- nodes_in_edge_extractor = identifiers.get("nodes_in_edge_extractor")
- location_extractor = identifiers.get("location_extractor")
+ entity_schema_class = schema_dict.get("entity_schema")
+ relation_schema_class = schema_dict.get("relation_schema")
+ entity_key_extractor = identifiers.get("entity_key_extractor")
+ relation_key_extractor = identifiers.get("relation_key_extractor")
+ entities_in_relation_extractor = identifiers.get("entities_in_relation_extractor")
+ location_in_relation_extractor = identifiers.get("location_in_relation_extractor")
prompt_builder = PromptBuilder(language)
- options = OptionsBuilder.build_spatial_options(config, language)
+ options = OptionsBuilder.build_spatial_graph_options(config, language)
- prompt, prompt_for_node_extraction, prompt_for_edge_extraction = (
+ prompt, prompt_for_entity_extraction, prompt_for_relation_extraction = (
OptionsBuilder.build_prompts(
config, prompt_builder, options.extraction_mode
)
)
return AutoSpatialGraph(
- node_schema=node_schema_class,
- edge_schema=edge_schema_class,
- node_key_extractor=node_key_extractor,
- edge_key_extractor=edge_key_extractor,
- nodes_in_edge_extractor=nodes_in_edge_extractor,
- location_extractor=location_extractor,
+ entity_schema=entity_schema_class,
+ relation_schema=relation_schema_class,
+ entity_key_extractor=entity_key_extractor,
+ relation_key_extractor=relation_key_extractor,
+ entities_in_relation_extractor=entities_in_relation_extractor,
+ location_in_relation_extractor=location_in_relation_extractor,
observation_location=options.observation_location,
llm_client=llm_client,
embedder=embedder,
extraction_mode=options.extraction_mode,
- node_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.node_merge_strategy,
- node_key_extractor,
+ entity_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
+ options.entity_merge_strategy,
+ entity_key_extractor,
llm_client,
- node_schema_class,
+ entity_schema_class,
),
- edge_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.edge_merge_strategy,
- edge_key_extractor,
+ relation_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
+ options.relation_merge_strategy,
+ relation_key_extractor,
llm_client,
- edge_schema_class,
+ relation_schema_class,
),
prompt=prompt,
- prompt_for_node_extraction=prompt_for_node_extraction,
- prompt_for_edge_extraction=prompt_for_edge_extraction,
+ prompt_for_entity_extraction=prompt_for_entity_extraction,
+ prompt_for_relation_extraction=prompt_for_relation_extraction,
chunk_size=options.chunk_size,
chunk_overlap=options.chunk_overlap,
max_workers=options.max_workers,
verbose=options.verbose,
- node_fields_for_index=options.node_search_fields,
- edge_fields_for_index=options.edge_search_fields,
+ entity_fields_for_index=options.entity_fields_for_search,
+ relation_fields_for_index=options.relation_fields_for_search,
)
@classmethod
@@ -366,59 +368,59 @@ class TemplateFactory:
schema_dict, identifiers = (
OptionsBuilder.validate_spatio_temporal_graph_config(config)
)
- node_schema_class = schema_dict.get("node_schema")
- edge_schema_class = schema_dict.get("edge_schema")
- node_key_extractor = identifiers.get("node_key_extractor")
- edge_key_extractor = identifiers.get("edge_key_extractor")
- nodes_in_edge_extractor = identifiers.get("nodes_in_edge_extractor")
- time_extractor = identifiers.get("time_extractor")
- location_extractor = identifiers.get("location_extractor")
+ entity_schema_class = schema_dict.get("entity_schema")
+ relation_schema_class = schema_dict.get("relation_schema")
+ entity_key_extractor = identifiers.get("entity_key_extractor")
+ relation_key_extractor = identifiers.get("relation_key_extractor")
+ entities_in_relation_extractor = identifiers.get("entities_in_relation_extractor")
+ time_in_relation_extractor = identifiers.get("time_in_relation_extractor")
+ location_in_relation_extractor = identifiers.get("location_in_relation_extractor")
prompt_builder = PromptBuilder(language)
options = OptionsBuilder.build_spatio_temporal_graph_options(
config, language
)
- prompt, prompt_for_node_extraction, prompt_for_edge_extraction = (
+ prompt, prompt_for_entity_extraction, prompt_for_relation_extraction = (
OptionsBuilder.build_prompts(
config, prompt_builder, options.extraction_mode
)
)
return AutoSpatioTemporalGraph(
- node_schema=node_schema_class,
- edge_schema=edge_schema_class,
- node_key_extractor=node_key_extractor,
- edge_key_extractor=edge_key_extractor,
- nodes_in_edge_extractor=nodes_in_edge_extractor,
- time_extractor=time_extractor,
- location_extractor=location_extractor,
+ entity_schema=entity_schema_class,
+ relation_schema=relation_schema_class,
+ entity_key_extractor=entity_key_extractor,
+ relation_key_extractor=relation_key_extractor,
+ entities_in_relation_extractor=entities_in_relation_extractor,
+ time_in_relation_extractor=time_in_relation_extractor,
+ location_in_relation_extractor=location_in_relation_extractor,
observation_time=options.observation_time,
observation_location=options.observation_location,
llm_client=llm_client,
embedder=embedder,
extraction_mode=options.extraction_mode,
- node_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.node_merge_strategy,
- node_key_extractor,
- llm_client,
- node_schema_class,
- ),
- edge_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
- options.edge_merge_strategy,
- edge_key_extractor,
- llm_client,
- edge_schema_class,
- ),
+ entity_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
+ options.entity_merge_strategy,
+ entity_key_extractor,
+ llm_client,
+ entity_schema_class,
+ ),
+ relation_strategy_or_merger=OptionsBuilder.resolve_merge_strategy(
+ options.relation_merge_strategy,
+ relation_key_extractor,
+ llm_client,
+ relation_schema_class,
+ ),
prompt=prompt,
- prompt_for_node_extraction=prompt_for_node_extraction,
- prompt_for_edge_extraction=prompt_for_edge_extraction,
+ prompt_for_entity_extraction=prompt_for_entity_extraction,
+ prompt_for_relation_extraction=prompt_for_relation_extraction,
chunk_size=options.chunk_size,
chunk_overlap=options.chunk_overlap,
max_workers=options.max_workers,
verbose=options.verbose,
- node_fields_for_index=options.node_search_fields,
- edge_fields_for_index=options.edge_search_fields,
+ entity_fields_for_index=options.entity_fields_for_search,
+ relation_fields_for_index=options.relation_fields_for_search,
)
@classmethod
@@ -480,14 +482,14 @@ class TemplateFactory:
"spatio_temporal_graph": cls.create_spatio_temporal_graph,
}
- creator = autotype_map.get(config.autotype)
+ creator = autotype_map.get(config.type)
if creator is None:
- raise ValueError(f"Unsupported autotype: {config.autotype}")
+ raise ValueError(f"Unsupported type: {config.type}")
template = creator(config, llm_client, embedder)
display_extractors = cls.resolve_display_extractors(config, {})
- return TemplateWrapper(template, display_extractors, config.autotype)
+ return TemplateWrapper(template, display_extractors, config.type)
def safe_getattr(obj, name, default):
@@ -506,8 +508,8 @@ class TemplateWrapper:
self._display_extractors = display_extractors
self._autotype = autotype
- self._node_label_extractor = display_extractors.get("node_label_extractor")
- self._edge_label_extractor = display_extractors.get("edge_label_extractor")
+ self._entity_label_extractor = display_extractors.get("entity_label_extractor")
+ self._relation_label_extractor = display_extractors.get("relation_label_extractor")
self._label_extractor = display_extractors.get("label_extractor")
def __getattr__(self, name):
@@ -522,9 +524,9 @@ class TemplateWrapper:
"spatial_graph",
"spatio_temporal_graph",
):
- if self._node_label_extractor and self._edge_label_extractor:
- kwargs.setdefault("node_label_extractor", self._node_label_extractor)
- kwargs.setdefault("edge_label_extractor", self._edge_label_extractor)
+ if self._entity_label_extractor and self._relation_label_extractor:
+ kwargs.setdefault("entity_label_extractor", self._entity_label_extractor)
+ kwargs.setdefault("relation_label_extractor", self._relation_label_extractor)
else:
if self._label_extractor:
kwargs.setdefault("label_extractor", self._label_extractor)
diff --git a/hyperextract/utils/template_engine/gallery.py b/hyperextract/utils/template_engine/gallery.py
index a349ab7..80141ea 100644
--- a/hyperextract/utils/template_engine/gallery.py
+++ b/hyperextract/utils/template_engine/gallery.py
@@ -33,7 +33,7 @@ class Gallery:
def __init__(self):
self._configs: Dict[str, TemplateConfig] = {}
- self._configs_by_autotype: Dict[str, List[str]] = {}
+ self._configs_by_type: Dict[str, List[str]] = {}
self._configs_by_tag: Dict[str, List[str]] = {}
@classmethod
@@ -65,10 +65,10 @@ class Gallery:
cls._instance._load_config(path)
@classmethod
- def get_by_autotype(cls, autotype: str) -> List[TemplateConfig]:
+ def get_by_type(cls, type_value: str) -> List[TemplateConfig]:
if not cls._instance:
return []
- names = cls._instance._configs_by_autotype.get(autotype, [])
+ names = cls._instance._configs_by_type.get(type_value, [])
return [cls._instance._configs[name] for name in names if name in cls._instance._configs]
@classmethod
@@ -79,12 +79,12 @@ class Gallery:
return [cls._instance._configs[name] for name in names if name in cls._instance._configs]
@classmethod
- def search(cls, query: str = None, autotype: str = None, tag: str = None, language: str = None) -> List[TemplateConfig]:
- """Search templates by query, autotype, tag, or language.
+ def search(cls, query: str = None, type_value: str = None, tag: str = None, language: str = None) -> List[TemplateConfig]:
+ """Search templates by query, type, tag, or language.
Args:
query: Search in template name/description
- autotype: Filter by autotype (e.g., "graph", "list")
+ type_value: Filter by type (e.g., "graph", "list")
tag: Filter by tag
language: Filter by language (e.g., "zh", "en")
@@ -105,10 +105,10 @@ class Gallery:
if query_lower not in name_match and (desc_value and query_lower not in str(desc_value).lower()):
continue
- if autotype and config.autotype != autotype:
+ if type_value and config.type != type_value:
continue
- if tag and (not config.tag or tag not in config.tag):
+ if tag and (not config.tags or tag not in config.tags):
continue
if language:
@@ -138,11 +138,11 @@ class Gallery:
return sorted(languages)
@classmethod
- def list_autotypes(cls) -> List[str]:
- """List all available autotypes."""
+ def list_types(cls) -> List[str]:
+ """List all available types."""
if not cls._instance:
return []
- return list(cls._instance._configs_by_autotype.keys())
+ return list(cls._instance._configs_by_type.keys())
@classmethod
def list_tags(cls) -> List[str]:
@@ -174,6 +174,7 @@ class Gallery:
lang: str = "zh",
llm_client=None,
embedder=None,
+ **kwargs,
):
"""Create template instance.
@@ -182,6 +183,7 @@ class Gallery:
lang: Language, default "zh"
llm_client: LLM client, optional, reads from global config if not provided
embedder: Embedder client, optional, reads from global config if not provided
+ **kwargs: Additional parameters (e.g., observation_time, observation_location)
Returns:
TemplateWrapper instance
@@ -197,6 +199,9 @@ class Gallery:
# Method 3: Mixed usage
template = Gallery.create("knowledge_graph", llm_client=my_llm)
+
+ # Method 4: With additional parameters
+ template = Gallery.create("FinancialTemporalGraph", observation_time="2024-06-15")
"""
config = cls._resolve_config(name, lang)
@@ -207,7 +212,7 @@ class Gallery:
embedder = embedder or default_emb
from .factory import TemplateFactory
- return TemplateFactory.create(config, llm_client, embedder)
+ return TemplateFactory.create(config, llm_client, embedder, **kwargs)
@classmethod
def _resolve_config(cls, name: str, lang: str = "zh") -> TemplateConfig:
@@ -245,13 +250,13 @@ class Gallery:
def _register(self, config: TemplateConfig) -> None:
self._configs[config.name] = config
- if config.autotype not in self._configs_by_autotype:
- self._configs_by_autotype[config.autotype] = []
- if config.name not in self._configs_by_autotype[config.autotype]:
- self._configs_by_autotype[config.autotype].append(config.name)
+ if config.type not in self._configs_by_type:
+ self._configs_by_type[config.type] = []
+ if config.name not in self._configs_by_type[config.type]:
+ self._configs_by_type[config.type].append(config.name)
- if config.tag:
- for tag in config.tag:
+ if config.tags:
+ for tag in config.tags:
if tag not in self._configs_by_tag:
self._configs_by_tag[tag] = []
if config.name not in self._configs_by_tag[tag]:
diff --git a/hyperextract/utils/template_engine/template.py b/hyperextract/utils/template_engine/template.py
index 84d36a4..7d15bb0 100644
--- a/hyperextract/utils/template_engine/template.py
+++ b/hyperextract/utils/template_engine/template.py
@@ -1,88 +1,164 @@
-"""Template - Unified template API."""
+"""Template API - Unified interface for template operations.
+
+Provides a clean API for searching and creating knowledge extraction templates.
+"""
+
+from typing import List, Optional
+
+from langchain_core.language_models import BaseChatModel
+from langchain_core.embeddings import Embeddings
from .gallery import Gallery
+from .builder import TemplateConfig
class Template:
- """Unified template API for searching and creating templates.
-
- Examples:
+ """Template API - Unified interface for template operations.
+
+ Usage Examples:
+ from hyperextract.utils.template_engine import Template
+
# List all templates
- Template.list()
-
+ print(Template.list())
+
# Search templates
- Template.search("知识图谱")
- Template.search(autotype="graph")
-
+ results = Template.search(query="财报", type_value="model")
+
# Get template config
- config = Template.get("knowledge_graph")
-
- # Create template (auto reads from global config)
- template = Template.create("knowledge_graph")
-
- # Create with custom clients
- template = Template.create("knowledge_graph", llm_client=llm, embedder=emb)
+ config = Template.get("EarningsCallSummary")
+
+ # Create template instance
+ template = Template.create("KnowledgeGraph", llm_client=llm, embedder=emb)
+ result = template.parse("your text here")
+
+ # List available domains
+ print(Template.domains())
"""
-
+
@staticmethod
- def list():
- """List all available template names."""
+ def list() -> List[str]:
+ """List all available template names.
+
+ Returns:
+ List of template names
+ """
return Gallery.list_all()
-
+
@staticmethod
- def search(query=None, autotype=None, tag=None, language=None):
- """Search templates by criteria.
-
+ def search(
+ query: Optional[str] = None,
+ type_value: Optional[str] = None,
+ tag: Optional[str] = None,
+ language: Optional[str] = None,
+ ) -> List[TemplateConfig]:
+ """Search templates by various criteria.
+
Args:
query: Search in template name/description
- autotype: Filter by autotype (e.g., "graph", "list")
- tag: Filter by tag
+ type_value: Filter by type (e.g., "graph", "list", "model")
+ tag: Filter by tag (e.g., "finance", "medicine")
language: Filter by language (e.g., "zh", "en")
-
+
Returns:
- List of TemplateConfig
+ List of matching TemplateConfig objects
"""
- return Gallery.search(query, autotype, tag, language)
-
+ return Gallery.search(
+ query=query,
+ type_value=type_value,
+ tag=tag,
+ language=language,
+ )
+
@staticmethod
- def get(name, lang="zh"):
- """Get template config by name.
-
+ def get(name: str, lang: str = "zh") -> Optional[TemplateConfig]:
+ """Get template configuration by name.
+
Args:
- name: Template name
- lang: Language
-
+ name: Template name (e.g., "KnowledgeGraph")
+ lang: Language, default "zh"
+
Returns:
- TemplateConfig
+ TemplateConfig or None if not found
"""
- return Gallery._resolve_config(name, lang)
-
+ return Gallery.get(name)
+
@staticmethod
- def create(name, lang="zh", llm_client=None, embedder=None):
+ def create(
+ name: str,
+ lang: str = "zh",
+ llm_client: Optional[BaseChatModel] = None,
+ embedder: Optional[Embeddings] = None,
+ **kwargs,
+ ):
"""Create template instance.
-
- If llm_client or embedder is not provided, automatically reads
- from global config (~/.he/config.toml).
-
+
Args:
- name: Template name (e.g., "knowledge_graph", "zh/finance/risk_assessment")
+ name: Template name (e.g., "KnowledgeGraph")
lang: Language, default "zh"
- llm_client: LLM client, optional
- embedder: Embedder client, optional
-
+ llm_client: LLM client (reads from global config if not provided)
+ embedder: Embedder client (reads from global config if not provided)
+ **kwargs: Additional parameters (e.g., observation_time, observation_location)
+
Returns:
TemplateWrapper instance
+
+ Examples:
+ # Basic usage (uses global config)
+ template = Template.create("KnowledgeGraph")
+
+ # With custom clients
+ template = Template.create(
+ "KnowledgeGraph",
+ llm_client=my_llm,
+ embedder=my_embedder
+ )
+
+ # For temporal/spatial templates
+ template = Template.create(
+ "FinancialTemporalGraph",
+ observation_time="2024-06-15"
+ )
"""
- return Gallery.create(name, lang, llm_client, embedder)
-
+ return Gallery.create(
+ name=name,
+ lang=lang,
+ llm_client=llm_client,
+ embedder=embedder,
+ **kwargs,
+ )
+
@staticmethod
- def domains():
- """List available domains with template count.
-
+ def domains() -> List[tuple]:
+ """List all available domains with template count.
+
Returns:
List of (domain_name, template_count) tuples
"""
return Gallery.list_domains()
+ @staticmethod
+ def types() -> List[str]:
+ """List all available template types.
+
+ Returns:
+ List of type names (e.g., ["model", "list", "graph", ...])
+ """
+ return Gallery.list_types()
+
+ @staticmethod
+ def tags() -> List[str]:
+ """List all available tags.
+
+ Returns:
+ List of tag names
+ """
+ return Gallery.list_tags()
+
+ @staticmethod
+ def languages() -> List[str]:
+ """List all available languages.
-__all__ = ["Template"]
+ Returns:
+ List of language codes (e.g., ["zh", "en"])
+ """
+ return Gallery.list_languages()
diff --git a/scripts/migrate_yaml_configs.py b/scripts/migrate_yaml_configs.py
new file mode 100644
index 0000000..c506631
--- /dev/null
+++ b/scripts/migrate_yaml_configs.py
@@ -0,0 +1,211 @@
+#!/usr/bin/env python3
+"""YAML Configuration Migration Script.
+
+Migrates YAML configuration files from old format to new format.
+
+Usage:
+ python scripts/migrate_yaml_configs.py
+"""
+
+import yaml
+from pathlib import Path
+from typing import Any, Dict, List, Union
+
+
+def convert_rules_to_array(rules_value: Union[str, List[str], Dict[str, Union[str, List[str]]]]) -> Union[List[str], Dict[str, List[str]]]:
+ """Convert string format rules to array format."""
+ if rules_value is None:
+ return None
+
+ if isinstance(rules_value, list):
+ return rules_value
+
+ if isinstance(rules_value, dict):
+ result = {}
+ for lang, value in rules_value.items():
+ if isinstance(value, str):
+ lines = []
+ for line in value.strip().split('\n'):
+ line = line.strip()
+ if line and line[0].isdigit():
+ parts = line.split('.', 1)
+ if len(parts) > 1:
+ line = parts[1].strip()
+ else:
+ line = ''.join(c for c in line if not c.isdigit() and c not in '.、').strip()
+ if line:
+ lines.append(line)
+ result[lang] = lines
+ else:
+ result[lang] = value
+ return result
+
+ if isinstance(rules_value, str):
+ lines = []
+ for line in rules_value.strip().split('\n'):
+ line = line.strip()
+ if line and line[0].isdigit():
+ parts = line.split('.', 1)
+ if len(parts) > 1:
+ line = parts[1].strip()
+ else:
+ line = ''.join(c for c in line if not c.isdigit() and c not in '.、').strip()
+ if line:
+ lines.append(line)
+ return lines
+
+ return rules_value
+
+
+def migrate_yaml_config(old: Dict[str, Any]) -> Dict[str, Any]:
+ """Migrate single YAML configuration."""
+ new = {}
+
+ new["language"] = old.get("language", "zh")
+ new["name"] = old["name"]
+ new["type"] = old.get("autotype", "model")
+ new["tags"] = old.get("tag", [])
+ new["description"] = old.get("description", {})
+
+ autotype = new["type"]
+
+ if autotype in ("model", "list", "set"):
+ old_schema = old.get("schema") or old.get("item_schema", {})
+ new["output"] = {
+ "description": old_schema.get("description", {}),
+ "fields": old_schema.get("fields", [])
+ }
+ else:
+ old_node_schema = old.get("node_schema", {})
+ old_edge_schema = old.get("edge_schema", {})
+
+ new["output"] = {
+ "description": {},
+ "entities": {
+ "description": old_node_schema.get("description", {}),
+ "fields": old_node_schema.get("fields", [])
+ },
+ "relations": {
+ "description": old_edge_schema.get("description", {}),
+ "fields": old_edge_schema.get("fields", [])
+ }
+ }
+
+ if "guide" in old:
+ guide = old["guide"]
+ new_guideline = {}
+
+ if "target" in guide:
+ new_guideline["target"] = guide["target"]
+
+ rules_fields = ["rules", "rules_for_nodes", "rules_for_edges", "rules_for_time", "rules_for_location"]
+ new_rules_fields = ["rules", "rules_for_entities", "rules_for_relations", "rules_for_time", "rules_for_location"]
+
+ for old_field, new_field in zip(rules_fields, new_rules_fields):
+ if old_field in guide:
+ new_guideline[new_field] = convert_rules_to_array(guide[old_field])
+
+ if new_guideline:
+ new["guideline"] = new_guideline
+
+ if "identifiers" in old:
+ ids = old["identifiers"]
+ if ids is None:
+ ids = {}
+ new_ids = {}
+ if "item_id" in ids:
+ new_ids["item_id"] = ids["item_id"]
+ if "node_id" in ids:
+ new_ids["entity_id"] = ids["node_id"]
+ if "edge_id" in ids:
+ new_ids["relation_id"] = ids["edge_id"]
+ if "edge_members" in ids:
+ new_ids["relation_members"] = ids["edge_members"]
+ if "time_field" in ids:
+ new_ids["time_field"] = ids["time_field"]
+ if "location_field" in ids:
+ new_ids["location_field"] = ids["location_field"]
+ if new_ids:
+ new["identifiers"] = new_ids
+
+ if "options" in old:
+ opts = old["options"]
+ new_opts = {}
+ for key in ["merge_strategy", "extraction_mode", "chunk_size", "chunk_overlap", "max_workers", "verbose"]:
+ if key in opts:
+ new_opts[key] = opts[key]
+ if "node_merge_strategy" in opts:
+ new_opts["entity_merge_strategy"] = opts["node_merge_strategy"]
+ if "edge_merge_strategy" in opts:
+ new_opts["relation_merge_strategy"] = opts["edge_merge_strategy"]
+ if "search_fields" in opts:
+ new_opts["fields_for_search"] = opts["search_fields"]
+ if "node_search_fields" in opts:
+ new_opts["entity_fields_for_search"] = opts["node_search_fields"]
+ if "edge_search_fields" in opts:
+ new_opts["relation_fields_for_search"] = opts["edge_search_fields"]
+ if new_opts:
+ new["options"] = new_opts
+
+ if "display" in old:
+ disp = old["display"]
+ new_disp = {}
+ if "label" in disp:
+ new_disp["label"] = disp["label"]
+ if "node_label" in disp:
+ new_disp["entity_label"] = disp["node_label"]
+ if "edge_label" in disp:
+ new_disp["relation_label"] = disp["edge_label"]
+ if new_disp:
+ new["display"] = new_disp
+
+ return new
+
+
+def migrate_all_yaml_files(presets_dir: Path, dry_run: bool = False):
+ """Migrate all YAML files."""
+ yaml_files = list(presets_dir.rglob("*.yaml"))
+ print(f"Found {len(yaml_files)} YAML files to migrate")
+
+ for yaml_file in yaml_files:
+ print(f"\nProcessing: {yaml_file}")
+
+ with open(yaml_file, "r", encoding="utf-8") as f:
+ old_config = yaml.safe_load(f)
+
+ if old_config is None:
+ print(f" Skipping empty file")
+ continue
+
+ if "autotype" not in old_config and "type" in old_config:
+ print(f" Already migrated, skipping")
+ continue
+
+ new_config = migrate_yaml_config(old_config)
+
+ if dry_run:
+ print(f" [DRY RUN] Would write new config:")
+ print(yaml.dump(new_config, allow_unicode=True, default_flow_style=False, sort_keys=False)[:500])
+ else:
+ with open(yaml_file, "w", encoding="utf-8") as f:
+ yaml.dump(new_config, f, allow_unicode=True, default_flow_style=False, sort_keys=False)
+ print(f" Migrated successfully")
+
+ print(f"\nMigration complete!")
+
+
+if __name__ == "__main__":
+ import argparse
+
+ parser = argparse.ArgumentParser(description="Migrate YAML configuration files")
+ parser.add_argument("--dry-run", action="store_true", help="Show what would be done without making changes")
+ parser.add_argument("--path", type=str, default=None, help="Path to presets directory")
+ args = parser.parse_args()
+
+ if args.path:
+ presets_dir = Path(args.path)
+ else:
+ presets_dir = Path(__file__).parent.parent / "hyperextract" / "templates" / "presets"
+
+ print(f"Presets directory: {presets_dir}")
+ migrate_all_yaml_files(presets_dir, dry_run=args.dry_run)
diff --git a/tests/test_data/templates/biography_scientist.md b/tests/test_data/templates/biography_scientist.md
new file mode 100644
index 0000000..4192b17
--- /dev/null
+++ b/tests/test_data/templates/biography_scientist.md
@@ -0,0 +1,165 @@
+# 祖冲之:中国古代科学巨匠
+
+**作者**:历史传记 陈静怡
+**出版年份**:2026年
+
+---
+
+## 序言
+
+祖冲之是中国南北朝时期杰出的数学家、天文学家和发明家。他在数学、天文历法、机械制造等多个领域都取得了卓越的成就,是中国古代科学史上的一座丰碑。
+
+本书旨在记录祖冲之不平凡的一生,展现他对科学的执着追求和对中华文明的伟大贡献。
+
+---
+
+## 第一章:早年岁月(429-450)
+
+### 1.1 出生与家庭
+
+429年(南朝宋文帝元嘉六年),祖冲之出生于**范阳郡遒县**(今河北省涞水县)的一个官宦世家。
+
+曾祖父**祖台之**,东晋时官至侍中、光禄大夫;祖父**祖昌**,南朝宋时任大匠卿(掌管土木工程的官职);父亲**祖朔之**,任奉朝请。在这样的家庭环境中,祖冲之从小就受到了良好的教育,对科学技术产生了浓厚兴趣。
+
+### 1.2 少年好学
+
+祖冲之自幼勤奋好学,博览群书,尤其对数学、天文和机械制造等方面的书籍情有独钟。
+
+史书载,祖冲之"少稽古,有机思",意思是他从小就研究古代典籍,有非凡的机智和思考能力。
+
+### 1.3 步入仕途
+
+450年左右,祖冲之进入官场,任南徐州(今江苏镇江)从事史,后又任公府参军。虽然身在仕途,但他始终没有放弃对科学研究的追求。
+
+---
+
+## 第二章:数学成就(450-470)
+
+### 2.1 圆周率计算
+
+祖冲之在数学上最杰出的贡献,是对圆周率(π)的精确计算。
+
+经过长期艰苦的研究,祖冲之得出:
+- **盈数(上限)**:3.1415927
+- **朒数(下限)**:3.1415926
+
+也就是说,圆周率的值在 **3.1415926 和 3.1415927 之间**,精确到了小数点后第7位。这一成就比西方数学家早了**一千多年**!
+
+为了计算方便,祖冲之还给出了两个分数形式的近似值:
+- **约率**:22/7(≈3.1429)
+- **密率**:355/113(≈3.1415929)
+
+其中,密率 355/113 是分子分母都在1000以内的最佳近似分数,这一成就也领先世界一千多年。
+
+### 2.2 《缀术》
+
+祖冲之将自己的数学研究成果写成了一部名为**《缀术》**的著作。
+
+《缀术》内容深奥,被称为"算学经书",后来成为唐代国子监算学馆的教科书之一。可惜的是,这部珍贵的数学著作在北宋时失传了。
+
+---
+
+## 第三章:天文历法(450-464)
+
+### 3.1 发现历法问题
+
+祖冲之在研究天文历法时,发现当时通行的**《元嘉历》**存在诸多误差。
+
+《元嘉历》由天文学家何承天制定,虽比之前的历法精密,但仍有不足之处。祖冲之经过多年观测和研究,指出了《元嘉历》的多个缺陷。
+
+### 3.2 创制《大明历》
+
+462年(南朝宋孝武帝大明六年),祖冲之编成了新的历法——**《大明历》**。
+
+《大明历》的主要创新包括:
+1. **引入岁差**:这是中国历法史上的重大突破,使回归年和恒星年得到区分
+2. **改进闰周**:将旧历法的19年7闰改为391年144闰,更加精确
+3. **测定交点月**:准确计算出交点月的日数为27.21223日,与现代测量值27.21222日相差极微
+4. **精密测定五星周期**:对金、木、水、火、土五大行星的运行周期进行了精确测定
+
+### 3.3 历法辩论
+
+《大明历》编成后,祖冲之上表给宋孝武帝,请求颁布施行。然而,这一建议遭到了权臣**戴法兴**的反对。
+
+戴法兴认为祖冲之"诬天背经",改变古法是大逆不道。祖冲之毫不畏惧,写下了著名的**《驳议》**一文,据理力争,逐条驳斥戴法兴的错误观点。
+
+这场辩论是中国古代科学史上的著名事件,展现了祖冲之坚持真理、不畏权贵的科学精神。
+
+可惜的是,由于戴法兴的阻挠,《大明历》在祖冲之生前未能颁布施行。直到510年(南朝梁武帝天监九年),在他的儿子**祖暅**的努力下,《大明历》才被正式采用,此时距离祖冲之去世已有10年。
+
+---
+
+## 第四章:机械发明(470-500)
+
+### 4.1 指南车
+
+祖冲之不仅是一位杰出的数学家和天文学家,还是一位出色的机械发明家。
+
+他成功制造了**指南车**。指南车是一种能够指示方向的车辆,相传黄帝时代就有,但制法早已失传。祖冲之根据古籍记载,经过反复研究和试验,终于成功复原了指南车。
+
+### 4.2 千里船
+
+祖冲之还发明了一种名为"**千里船**"的船只。
+
+据《南齐书·祖冲之传》记载:"于新亭江试之,日行百余里。"也就是说,千里船在新亭江(今江苏南京附近)试航时,一天能航行一百多里,这在当时是非常了不起的成就。
+
+### 4.3 水碓磨
+
+祖冲之还制造了**水碓磨**,这是一种利用水力驱动的粮食加工工具。
+
+水碓磨将水碓和水磨结合起来,能够同时舂米和磨面,大大提高了生产效率。这一发明对农业生产的发展起到了重要作用。
+
+### 4.4 计时器
+
+此外,祖冲之还制造了**欹器**(一种计时器)和其他精巧的机械装置,展现了他卓越的机械制造才能。
+
+---
+
+## 第五章:历史影响与评价
+
+### 5.1 国际认可
+
+祖冲之的科学成就得到了国际科学界的广泛认可。
+
+为了纪念祖冲之的杰出贡献:
+- 1964年,紫金山天文台发现的一颗小行星被命名为**"祖冲之星"**
+- 月球上的一座环形山被命名为**"祖冲之环形山"**
+
+### 5.2 历史评价
+
+《南齐书·祖冲之传》评价他:"冲之解钟律博塞,当时独绝,莫能对者。"
+
+意思是祖冲之精通音律、棋艺等各种技艺,当时无人能及。
+
+**李约瑟**(英国著名科学史学家)在《中国科学技术史》中对祖冲之给予了高度评价,称他是"中国古代最伟大的数学家之一"。
+
+### 5.3 科学精神
+
+祖冲之的身上,体现了中国古代科学家的优秀品质:
+- **实事求是**:坚持从实际观测出发
+- **勇于创新**:敢于突破旧说,提出新见
+- **严谨细致**:对科学研究精益求精
+- **不畏权贵**:敢于坚持真理,据理力争
+
+---
+
+## 结语
+
+祖冲之是中国古代科学史上的一位全才,他在数学、天文、机械等多个领域都取得了卓越成就。
+
+他的圆周率计算领先世界一千多年,他的《大明历》是中国历法史上的里程碑,他的机械发明展现了中国古代人民的智慧。
+
+祖冲之的科学精神和成就,不仅是中华民族的骄傲,也是世界科学文化宝库中的珍贵遗产。他的名字,永远铭刻在人类科学发展的历史长河中。
+
+---
+
+## 附录:祖冲之年谱
+
+- **429年**:出生于范阳郡遒县(今河北涞水)
+- **450年左右**:任南徐州从事史、公府参军
+- **462年**:编成《大明历》,上表朝廷
+- **462-464年**:与戴法兴辩论历法
+- **470年代**:制造指南车、千里船、水碓磨
+- **494-498年**:任长水校尉
+- **500年**:逝世,享年72岁
+- **510年**:《大明历》被正式采用