Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.
feat(template-optimizer): 新增模板优化技能及参考规则
yifanfeng97e2b8d48276cb
diff --git a/hyperextract-skills/README.md b/hyperextract-skills/README.mdindex 97b6f23..938a414 100644--- a/hyperextract-skills/README.md+++ b/hyperextract-skills/README.md@@ -12,6 +12,7 @@ Knowledge template design skills for Hyper-Extract.| graph-designer | Design graph/hypergraph/etc structures || yaml-validator | Validate YAML configurations || multilingual | Convert to multi-language support |+| template-optimizer | Optimize templates and fix common issues |## Installation@@ -43,8 +44,9 @@ cp -r hyperextract-skills ~/.trae/skills/1. Start with the brainstorm skill to explore your requirements2. Based on the recommended type, use either record-designer or graph-designer-3. Optionally validate with yaml-validator-4. Optionally convert to multilingual+3. **Optimize with template-optimizer** (recommended)+4. Optionally validate with yaml-validator+5. Optionally convert to multilingual### Example Workflow@@ -111,8 +113,15 @@ hyperextract-skills/│ ├── rules-types.md│ ├── rules-identifiers.md│ └── rules-errors.md-└── multilingual/- └── SKILL.md # Multi-language conversion+├── multilingual/+│ └── SKILL.md # Multi-language conversion+└── template-optimizer/+ ├── SKILL.md # Template optimization+ └── references/ # Optimization rules+ ├── rules-naming.md+ ├── rules-multilingual.md+ ├── rules-field-count.md+ └── rules-consistency.md```## Design Principlesdiff --git a/hyperextract-skills/graph-designer/SKILL.md b/hyperextract-skills/graph-designer/SKILL.mdindex 22cd263..049e11b 100644--- a/hyperextract-skills/graph-designer/SKILL.md+++ b/hyperextract-skills/graph-designer/SKILL.md@@ -204,3 +204,21 @@ identifiers:- [ ] relation_id template correct?- [ ] relation_members configured?- [ ] time/location_field specified?++### Multi-language+- [ ] `zh` descriptions use pure Chinese (no English terms like `entity(...)`)+- [ ] `en` descriptions use pure English (no Chinese characters)++### Entity-Relation Consistency+- [ ] source/target types match entities definition++### Relation Type Design+For **generic templates**: Use open-ended description+```yaml+en: 'Relation type, concisely describing the connection between entities'+```++For **domain-specific templates**: Can use predefined types+```yaml+en: 'Relation type: type_a/type_b/type_c'+```diff --git a/hyperextract-skills/multilingual/SKILL.md b/hyperextract-skills/multilingual/SKILL.mdindex b3ff782..7813c25 100644--- a/hyperextract-skills/multilingual/SKILL.md+++ b/hyperextract-skills/multilingual/SKILL.md@@ -94,6 +94,17 @@ rules:- 'Each field corresponds to an independent information item'```+### Multi-language Consistency++When translating field values (like enum options), maintain language purity:++| Original | Chinese Translation | English Translation |+|----------|-------------------|-------------------|+| `类型:实体/抽象` | `类型:实体/抽象` | `Type: entity/abstract` |+| `重要性:高/中/低` | `重要性:高/中/低` | `Significance: high/medium/low` |++Do NOT translate inline: `类型:entity(实体)` → wrong!+## Translation Checklist- [ ] Preserve technical terms consistentlydiff --git a/hyperextract-skills/record-designer/SKILL.md b/hyperextract-skills/record-designer/SKILL.mdindex f26614a..c6444d4 100644--- a/hyperextract-skills/record-designer/SKILL.md+++ b/hyperextract-skills/record-designer/SKILL.md@@ -131,3 +131,7 @@ identifiers:- [ ] Quality requirements specified?- [ ] Common mistakes warned?- [ ] For set: deduplication rules clear?++### Multi-language+- [ ] `zh` descriptions use pure Chinese+- [ ] `en` descriptions use pure Englishdiff --git a/hyperextract-skills/template-optimizer/SKILL.md b/hyperextract-skills/template-optimizer/SKILL.mdnew file mode 100644index 0000000..8eed8c5--- /dev/null+++ b/hyperextract-skills/template-optimizer/SKILL.md@@ -0,0 +1,174 @@+---+name: template-optimizer+description: |+ Optimize YAML templates for Hyper-Extract.+ Use when: "optimize template", "fix YAML issues", "improve quality", "lint template"+ Trigger: After creating templates or during review+ Skip: Creating new templates (use brainstorm + designer instead)+---++# Template Optimizer++Automatically analyze and optimize YAML templates by applying best practices and fixing common issues.++## Workflow++```+1. Parse YAML → 2. Analyze Issues → 3. Apply Fixes → 4. Generate Report+```++### Step 1: Parse YAML++Load the YAML template and validate basic structure.++### Step 2: Analyze Issues++Check against these rules:++| Rule | What to Check |+|------|--------------|+| [rules-naming.md](references/rules-naming.md) | Field naming standardization |+| [rules-multilingual.md](references/rules-multilingual.md) | Language consistency |+| [rules-field-count.md](references/rules-field-count.md) | Information density |+| [rules-consistency.md](references/rules-consistency.md) | Schema vs Guideline separation |++### Step 3: Apply Fixes++Apply fixes based on optimization level:++| Level | Description | Example |+|-------|-------------|---------|+| **Auto-fix** | Safe changes that always improve | `relation_type` → `type` |+| **Suggest** | Changes that may need review | Field count > 5 |+| **Review** | Design decisions | Relation type openness |++### Step 4: Generate Report++Output changes with explanations for learning.++---++## Detection Rules++### Rule 1: Multi-language Consistency++```+❌ Pattern: [a-zA-Z]+\([^)]+\) in zh fields+❌ Pattern: Chinese chars in en fields+```++**Fix**: Separate language content, use pure Chinese in zh, pure English in en.++### Rule 2: Field Naming++```+❌ relation_type → type+❌ event_date → time+❌ entity_type → type+```++**Fix**: Standardize to concise names.++### Rule 3: Field Count++```+⚠️ entities.fields > 5 → Flag for review+⚠️ relations.fields > 5 → Flag for review+```++**Fix**: Simplify to essential fields, use priority: Essential → Important → Optional.++### Rule 4: Schema-Guideline Separation++```+❌ Repetition of field definitions in guideline+❌ Schema descriptions in rules+```++**Fix**: Schema defines WHAT, Guideline defines HOW TO DO WELL.++---++## Design Principles++### Schema vs Guideline++| Schema Defines | Guideline Defines |+|---------------|-----------------|+| Field names | Extraction strategy |+| Field types | Quality requirements |+| Field descriptions | Creation conditions |+| Required/optional | Common mistakes |++**❌ Wrong**: Guideline repeats schema definitions+**✅ Correct**: Guideline explains how to extract well++### Information Density++For **entities** and **relations**:++| Field Priority | Examples |+|---------------|---------|+| Essential | source, target, participants |+| Important | type, time, location |+| Optional | description, metadata |++**Max**: 5 fields per component++### Naming Conventions++| For | Use | Example |+|-----|------|---------|+| Template name | CamelCase | `EarningsSummary` |+| Field names | snake_case | `company_name` |+| Tags | lowercase | `finance, investor` |++---++## Reference Files++| Topic | When to Check |+|-------|--------------|+| [rules-naming.md](references/rules-naming.md) | Field naming issues |+| [rules-multilingual.md](references/rules-multilingual.md) | Language consistency |+| [rules-field-count.md](references/rules-field-count.md) | Too many fields |+| [rules-consistency.md](references/rules-consistency.md) | Schema-guideline overlap |++---++## Output Format++```markdown+# Optimization Report++## Changes Made++| File | Issue | Fix | Level |+|------|-------|-----|-------|+| template.yaml | `relation_type` | renamed to `type` | Auto-fix |+| template.yaml | Mixed language | Fixed zh/en separation | Auto-fix |+| template.yaml | 7 relation fields | Suggested simplification | Suggest |++## Summary++- Auto-fix: 2+- Suggestions: 1+- Manual review: 0+```++---++## Integration++```+Full workflow: brainstorm → designer → optimizer → validator+ ↓+ Apply best practices+ Auto-fix common issues+```++**When to use**:+- After creating new templates+- Before validator+- During template review+- Batch optimization of existing templatesdiff --git a/hyperextract-skills/template-optimizer/references/rules-consistency.md b/hyperextract-skills/template-optimizer/references/rules-consistency.mdnew file mode 100644index 0000000..43f79b2--- /dev/null+++ b/hyperextract-skills/template-optimizer/references/rules-consistency.md@@ -0,0 +1,122 @@+# Schema vs Guideline Consistency++Separation of concerns between schema definition and extraction guidelines.++---++## Core Principle++| Schema (output) | Guideline (rules) |+|-----------------|------------------|+| Defines WHAT | Defines HOW TO DO WELL |+| Field structure | Extraction strategy |+| Type definitions | Quality requirements |+| Descriptions | Common mistakes |++---++## What Belongs Where++### Schema (output)++```yaml+output:+ entities:+ fields:+ - name: name+ type: str+ description: 'Person name' # What it is+ required: true+```++### Guideline (rules)++```yaml+guideline:+ rules_for_entities:+ - 'Extract full names as they appear in text'+ - 'Maintain naming consistency throughout document'+ - 'Only extract named persons, not pronouns'+```++---++## Common Mistakes++### ❌ Repeating Schema in Guideline++```yaml+# Wrong - repeats schema+guideline:+ rules_for_entities:+ - 'Extract name field as entity name'+ - 'Extract type field as entity category'+```++### ✅ Guideline Focuses on Extraction++```yaml+# Correct - explains how to extract+guideline:+ rules_for_entities:+ - 'Extract full names as they appear'+ - 'Categorize based on context clues'+```++---++## Checklist++| Check | Guideline Should | Guideline Should NOT |+|-------|-----------------|---------------------|+| Field names | Extraction strategy | "name should be..." |+| Field types | Quality requirements | "type field is..." |+| Required/optional | Creation conditions | "required: true" |+| Descriptions | Common mistakes | Schema definitions |++---++## Examples++### Model Template++```yaml+# Schema+output:+ fields:+ - name: company_name+ type: str+ description: 'Company name'++# Guideline+guideline:+ rules:+ - 'Extract official company names'+ - 'Use abbreviations if that's how they appear'+ - 'Standardize formats like "Inc.", "Ltd."'+```++### Graph Template++```yaml+# Schema+relations:+ fields:+ - name: type+ description: 'Relationship type'++# Guideline+rules_for_relations:+ - 'Use verbs or prepositions to describe relations'+ - 'Match terminology from source text'+ - 'Keep relation types consistent'+```++---++## Detection++Flag for review when guideline contains:+- Field definitions from schema+- "should be" or "must be" referencing schema fields+- Repetition of `description` contentdiff --git a/hyperextract-skills/template-optimizer/references/rules-field-count.md b/hyperextract-skills/template-optimizer/references/rules-field-count.mdnew file mode 100644index 0000000..0cc4600--- /dev/null+++ b/hyperextract-skills/template-optimizer/references/rules-field-count.md@@ -0,0 +1,94 @@+# Information Density Rules++Guidelines for keeping templates focused and readable.++---++## Core Principle++**Limit entity/relation fields to ≤5 for visual clarity and cognitive load.**++| Component | Max Fields | Reason |+|-----------|-----------|--------|+| `entities.fields` | 5 | Visual clarity in graph nodes |+| `relations.fields` | 5 | Readable edge labels |++---++## Field Priority++### Essential (Always Include)++| For | Fields |+|-----|--------|+| Graph | `source`, `target` |+| Hypergraph | `participants` (or grouping fields) |+| Temporal | `time` |+| Spatial | `location` |++### Important (Include If Needed)++| For | Fields |+|-----|--------|+| Type identification | `type` |+| Context | `description` |+| Metadata | `category`, `role` |++### Optional (Use Sparingly)++| For | Fields |+|-----|--------|+| Additional context | `notes` |+| Quality indicators | `confidence` |+| External references | `source` |++---++## Simplification Strategies++When fields exceed 5:++1. **Merge related fields**: `first_name` + `last_name` → `name`+2. **Move to description**: Move optional details to `description` field+3. **Use grouping**: Extract sub-fields into nested structure+4. **Prioritize**: Keep essential, mark others as optional++---++## Examples++### ❌ Too Many Fields (7)++```yaml+relations:+ fields:+ - name: source+ - name: target+ - name: type+ - name: strength+ - name: description+ - name: source_context+ - name: target_context+```++### ✅ Simplified (5)++```yaml+relations:+ fields:+ - name: source+ - name: target+ - name: type+ - name: strength+ - name: description # Includes context info+```++---++## Detection++Flag for review when:+- `entities.fields` > 5+- `relations.fields` > 5++**Note**: This is a suggestion, not an error. Some templates may legitimately need more fields.diff --git a/hyperextract-skills/template-optimizer/references/rules-multilingual.md b/hyperextract-skills/template-optimizer/references/rules-multilingual.mdnew file mode 100644index 0000000..2c21a71--- /dev/null+++ b/hyperextract-skills/template-optimizer/references/rules-multilingual.md@@ -0,0 +1,87 @@+# Multi-language Consistency Rules++Ensure language purity in bilingual templates.++---++## Core Principle++**Each language field should use that language's own terminology.**++| Field | Rule | Example |+|-------|------|---------|+| `zh` | Pure Chinese | `类型:实体` |+| `en` | Pure English | `Type: entity` |++---++## Common Issues++### Issue 1: Mixed Language in zh++```+❌ Wrong+zh: '类型:entity(实体)/abstract(抽象概念)'+en: 'Type: entity/abstract'++✅ Correct+zh: '类型:实体/抽象概念'+en: 'Type: entity/abstract'+```++**Pattern to detect**: `[a-zA-Z]+\([^)]+\)` in zh fields++### Issue 2: Mixed Language in en++```+❌ Wrong+zh: '类型:实体/抽象'+en: 'Type: 实体/抽象'++✅ Correct+zh: '类型:实体/抽象'+en: 'Type: entity/abstract'+```++**Pattern to detect**: `[\u4e00-\u9fa5]+` in en fields++---++## Auto-fix Rules++1. **Remove English terms from zh**: Extract `entity(...)` → `实体`+2. **Remove Chinese chars from en**: Translate to English equivalents++---++## Translation Patterns++When translating enum values:++| Original (zh) | English (en) |+|--------------|--------------|+| 实体 | entity |+| 抽象概念 | abstract |+| 过程 | process |+| 关系 | relation |+| 高/中/低 | high/medium/low |+| 人物/事件/地点 | person/event/location |++---++## Special Cases++### Field Names vs Field Values++```+# Field names can be in English (they're identifiers)+name: type+description:+ zh: '类型'+ en: 'Type'++# Field values should match language+description:+ zh: '类型:实体' # zh values in Chinese+ en: 'Type: entity' # en values in English+```diff --git a/hyperextract-skills/template-optimizer/references/rules-naming.md b/hyperextract-skills/template-optimizer/references/rules-naming.mdnew file mode 100644index 0000000..968aec5--- /dev/null+++ b/hyperextract-skills/template-optimizer/references/rules-naming.md@@ -0,0 +1,64 @@+# Field Naming Standards++Standardized field names for consistency across templates.++---++## Naming Conventions++| Element | Convention | Example |+|---------|-----------|---------|+| Template name | CamelCase | `EarningsSummary` |+| Field names | snake_case | `company_name` |+| Tags | lowercase, comma-separated | `finance, investor` |++---++## Standard Field Names++### Graph Types (relations)++| Wrong | Correct | Reason |+|-------|---------|--------|+| `relation_type` | `type` | Redundant - already in relation context |+| `event_date` | `time` | More generic for temporal graphs |+| `location_info` | `location` | Shorter, clearer |+| `participant_list` | `participants` | Consistent with hypergraph |++### Entity Types++| Wrong | Correct | Reason |+|-------|---------|--------|+| `entity_type` | `type` | Consistency with relations |+| `object_type` | `type` | Shorter, same meaning |+| `node_category` | `type` | Shorter |++### Common Fields++| Wrong | Correct | Reason |+|-------|---------|--------|+| `created_at` | `created` | Shorter |+| `updated_at` | `updated` | Shorter |+| `description_text` | `description` | Redundant suffix |++---++## Detection Patterns++```+relation_type → type+entity_type → type+event_date → time+```++---++## Auto-fix Rules++These are safe to auto-fix:++1. `relation_type` → `type`+2. `event_date` → `time`+3. `entity_type` → `type`++**Note**: Also update identifiers.relation_id template and display.relation_label references.diff --git a/hyperextract-skills/yaml-validator/references/rules-syntax.md b/hyperextract-skills/yaml-validator/references/rules-syntax.mdindex 7930f3d..8d0339d 100644--- a/hyperextract-skills/yaml-validator/references/rules-syntax.md+++ b/hyperextract-skills/yaml-validator/references/rules-syntax.md@@ -82,3 +82,14 @@ options: {...}2. Verify all required fields present3. Check naming conventions4. Validate field value types++---++## Multi-language Consistency++| Field | Rule | ❌ Wrong | ✅ Correct |+|-------|------|----------|------------|+| `zh` | Pure Chinese | `类型:entity(实体)` | `类型:实体/抽象` |+| `en` | Pure English | `Type: 实体` | `Type: entity/abstract` |++Detection pattern: `[a-zA-Z]+\([^)]+\)` in `zh` fields.diff --git a/hyperextract/cli/commands/list.py b/hyperextract/cli/commands/list.pyindex e1a729c..96346b2 100644--- a/hyperextract/cli/commands/list.py+++ b/hyperextract/cli/commands/list.py@@ -3,6 +3,7 @@from typing import Optionalfrom rich.console import Consolefrom rich.table import Table+from rich.text import Textimport typerfrom hyperextract.utils.template_engine import Gallery@@ -15,11 +16,11 @@ app = typer.Typer()-def _get_description(cfg) -> str:+def _get_description(cfg, lang: str = "en") -> str:"""Get description from template config, handling both str and dict types."""desc = cfg.descriptionif isinstance(desc, dict):- return desc.get("zh", desc.get("en", ""))+ return desc.get(lang, desc.get("en", ""))return desc or ""@@ -27,31 +28,36 @@ def _get_description(cfg) -> str:def template(query: Optional[str] = typer.Option(None, "--query", "-q", help="Query to search templates"),autotype: Optional[str] = typer.Option(None, "--autotype", "-a", help="Filter by autotype"),- language: Optional[str] = typer.Option(None, "--lang", "-l", help="Filter by language"),+ language: Optional[str] = typer.Option(None, "--lang", "-l", help="Language filter (en/zh/all, default: en)"),include_methods: bool = typer.Option(True, "--include-methods/--no-methods", help="Include method templates"),):"""List all available templates with detailed information."""+ target_lang = language if language else "en"+results = Gallery.list(filter_by_query=query,filter_by_type=autotype,- filter_by_language=language,+ filter_by_language=None if target_lang == "all" else target_lang,)templates = []for path, cfg in results.items():- full_name = cfg.name- languages = cfg.language if cfg.language else ["zh"]+ languages = cfg.language if cfg.language else ["en"]if isinstance(languages, str):languages = [languages]- for lang in languages:- templates.append((path, full_name, lang, cfg.type, _get_description(cfg)))+ if target_lang == "all":+ for lang in languages:+ templates.append((path, cfg.type, _get_description(cfg, lang)))+ else:+ lang = target_lang if target_lang in languages else (languages[0] if languages else "en")+ templates.append((path, cfg.type, _get_description(cfg, lang)))- if include_methods:+ if include_methods and target_lang != "zh":from hyperextract.methods import list_method_cfgsmethod_templates = list_method_cfgs()for name, cfg in method_templates.items():- templates.append((name, cfg.name, "en", cfg.type, cfg.description))+ templates.append((name, cfg.type, cfg.description))if not templates:console.print("[yellow]No templates found.[/yellow]")@@ -62,16 +68,15 @@ def template(show_header=True,header_style="bold magenta",expand=True,+ show_lines=True,)- table.add_column("Template ID", style="cyan", no_wrap=True, width=30)- table.add_column("Name", style="green", width=20)- table.add_column("Type", style="yellow", no_wrap=True, width=12)- table.add_column("Language", style="magenta", no_wrap=True, width=8)+ table.add_column("Template ID", style="cyan", width=26)+ table.add_column("Type", style="yellow", no_wrap=True, width=22)table.add_column("Description", style="white")- for tid, name, lang, template_type, desc in templates:- desc_text = desc[:60] + "..." if len(desc) > 60 else desc- table.add_row(tid, name, template_type, lang, desc_text)+ for tid, template_type, desc in templates:+ domain, name = tid.split("/", 1)+ table.add_row(Text(f"{domain}/\n{name}", style="cyan"), template_type, desc)console.print(table)console.print(f"\n[dim]Total: {len(templates)} templates[/dim]")diff --git a/hyperextract/templates/PLANNING_TEMPLATES_REDESIGN.md b/hyperextract/templates/PLANNING_TEMPLATES_REDESIGN.mdnew file mode 100644index 0000000..50942d6--- /dev/null+++ b/hyperextract/templates/PLANNING_TEMPLATES_REDESIGN.md@@ -0,0 +1,879 @@+# Hyper-Extract 知识模板重构计划++## 📋 项目现状分析++### 当前结构+```+templates/+├── presets/ # 6个核心领域+│ ├── finance/ # 金融+│ ├── general/ # 通用(需保留base_*)+│ ├── industry/ # 工业+│ ├── legal/ # 法律+│ ├── medicine/ # 医学+│ └── tcm/ # 中医+└── legacy/ # 旧模板(归档,待清理)+ ├── presets/ # 6个归档领域+ └── zh/ # Python模板+```++### 现有问题+1. **过度设计**:创建了自我想象的需求+2. **模板膨胀**:许多模板功能重叠,用户难以选择+3. **脱离实际需求**:缺乏对技术趋势的响应++---++## 🔥 GitHub热点调研结论(2026年3月)++### 关键技术趋势+- **Agentic AI**:Sub-agents、Memory、Skills组合成为主流+- **MCP (Model Context Protocol)**:正在成为Agent间通信标准+- **Skills Marketplace**:3.7万+个可安装skill+- **Workflow as Code**:YAML配置文件定义AI工作流++---++## 🎯 重新设计原则++1. **用户真实需求驱动**:不是"可能有用",而是"真正需要"+2. **控制模板数量**:每个领域5-8个精选模板+3. **言简意赅命名**:模板名称简洁明了+4. **每个图需描述**:明确用于什么文档、建模什么、可视化什么+5. **保持base_*不变**:通用基础模板已完善++---++## 📚 1. **general** - 通用领域 ⭐++### 设计原则+通用领域服务于所有文档类型,重点关注AI时代新需求和通用文档分析。++### 模板清单++#### 保留项(9个)++| 模板 | 类型 | 描述 |+|------|------|------|+| `base_graph` | graph | 通用图基础 |+| `base_hypergraph` | hypergraph | 通用超图基础 |+| `base_list` | list | 通用列表基础 |+| `base_model` | model | 通用模型基础 |+| `base_set` | set | 通用集合基础 |+| `base_temporal_graph` | temporal_graph | 时序图基础 |+| `base_spatial_graph` | spatial_graph | 空间图基础 |+| `base_spatio_temporal_graph` | spatio_temporal_graph | 时空图基础 |++#### 新增项(3个)++##### 1.1 `workflow_graph` - 流程图++**用于文档**:Skill定义文件(SKILL.md)、Agent工作流文档、SOP操作手册、业务流程说明++**建模内容**:步骤名称、步骤类型(skill/step/condition/branch)、输入要求、输出结果、条件分支++**可视化什么**:展示步骤之间的执行顺序、依赖关系、分支汇聚,形成流程可视化图++```yaml+type: temporal_graph+核心要素:+ - step_name: 步骤名称+ - step_type: 类型(skill/step/condition/branch)+ - description: 步骤描述+ - input: 输入要求+ - output: 输出结果+关系:+ - next: 顺序执行+ - triggers: 触发条件+ - branches_to: 条件分支+ - converges: 汇聚点+```++---++##### 1.2 `doc_structure` - 文档结构图++**用于文档**:技术文档(README、API docs)、论文、报告、规范文档++**建模内容**:章节标题、节点类型(chapter/section/paragraph/code/table)、层级深度、内容摘要、交叉引用++**可视化什么**:展示文档的层级结构、章节关系、引用关系,便于理解长文档脉络++```yaml+type: graph+核心要素:+ - node_type: 节点类型(chapter/section/paragraph/code/table)+ - title: 标题/名称+ - level: 层级深度+ - summary: 内容摘要+关系:+ - contains: 包含关系(父→子)+ - references: 引用关系(交叉引用)+```++---++##### 1.3 `biography_graph` - 传记图++**用于文档**:人物传记、回忆录、年谱、人物介绍文章++**建模内容**:事件名称、发生日期、发生地点、重要性、涉及人物、人物关系++**可视化什么**:展示人物的关键事件人生轨迹、事件因果关系、人物互动网络++```yaml+type: temporal_graph+核心要素:+ - event: 事件名称+ - event_date: 发生日期+ - location: 发生地点+ - significance: 重要性(高/中/低)+ - participants[]: 涉及人物+关系:+ - precedes: 时间先后+ - causes: 因果关系+ - involves: 参与关系+```++---++##### 1.4 `concept_graph` - 概念关系图++**用于文档**:教科书、百科全书、学术论文、概念解释文档++**建模内容**:概念名称、概念类型(实体/抽象/过程)、定义、层级关系++**可视化什么**:展示概念之间的层级关系(is-a/part-of)、语义关联,形成知识地图++```yaml+type: graph+核心要素:+ - concept: 概念名称+ - category: 概念类型(实体/抽象/过程/关系)+ - definition: 简要定义+关系:+ - subclass_of: 层级关系(子类)+ - part_of: 组成关系(部分)+ - related_to: 相关关系+```++---++### 删除项+- ❌ `clause_list` → 合并到legal+- ❌ `compliance_logic` → 合并到legal+- ❌ `knowledge_graph` → 用base_graph替代+- ❌ `social_network` → 过于泛化+- ❌ `cross_reference_net` → 用doc_structure替代+- ❌ `life_event_timeline` → 重命名为biography_graph++**general预期数量:13个(原14个)**++---++## 💰 2. **finance** - 金融++### 设计原则+金融领域用户需求明确,保留高频使用模板。++### 模板清单(5个)++##### 2.1 `earnings_summary` - 财报会议摘要++**用于文档**:财报电话会议记录(Earnings Call Transcript)++**建模内容**:公司名、季度、收入/EPS实际值、与预期对比、前瞻指引、整体基调、亮点/关切++**可视化什么**:快速理解会议核心内容,把握管理层信心和关键议题++```yaml+type: model+核心字段:+ - company_name, quarter+ - reported_revenue, reported_eps+ - revenue_vs_consensus, eps_vs_consensus+ - guidance_revenue, guidance_eps+ - overall_tone+ - key_highlights[], key_concerns[]+```++---++##### 2.2 `sentiment_model` - 市场情绪模型++**用于文档**:财经新闻、市场评论、研究报告、社交媒体帖子++**建模内容**:情绪分数(-1到1)、主导主题、关键实体、价格影响++**可视化什么**:量化市场情绪变化,识别舆情与股价的关联++```yaml+type: model+核心字段:+ - sentiment_score: -1到1+ - dominant_theme: 主导主题+ - key_entities[]: 关键实体+ - price_impact: 价格影响+```++---++##### 2.3 `event_timeline` - 重大事件时间线++**用于文档**:8-K报告、新闻稿、公司公告、投资评级调整++**建模内容**:事件名称、事件日期、重大性(是否重大)、影响程度++**可视化什么**:展示公司重要事件的时间顺序和因果关系,支持事件驱动分析++```yaml+type: temporal_graph+核心要素:+ - event: 事件名称+ - event_date: 事件日期+ - materiality: 重大性+关系:+ - causes: 因果关系+ - precedes: 时间先后+```++---++##### 2.4 `ownership_graph` - 股权结构图++**用于文档**:招股说明书(IPO S-1)、年度报告(10-K)、股东名册++**建模内容**:股东名称、持股比例、股东类型(机构/个人/关联方)、控制权关系++**可视化什么**:展示股权层级结构、控制关系路径,辅助尽职调查和UBO识别++```yaml+type: graph+核心要素:+ - shareholder: 股东名称+ - shareholder_type: 股东类型+ - ownership_percentage: 持股比例+关系:+ - controls: 控制关系+ - belongs_to: 归属集团+```++---++##### 2.5 `risk_factor_set` - 风险因子集合++**用于文档**:年报风险章节(10-K Item 1A)、季报风险披露、招股说明书风险章节++**建模内容**:风险因子、风险类别(经营/财务/市场/法规)、严重程度++**可视化什么**:提取和归类风险因子,便于风险监控和比较分析++```yaml+type: set+核心要素:+ - risk_factor: 风险因子+ - severity: 严重程度+ - category: 风险类别+```++---++### 删除项+- ❌ `SupplyChainGraph` → 合并到其他或删除+- ❌ `MDANarrativeGraph` → 合并到event_timeline+- ❌ `DiscussionGraph` → 使用率低+- ❌ `FactorInfluenceHypergraph` → 过于复杂+- ❌ `ValuationLogicMap` → 过于主观+- ❌ 其他20+个模板 → 删除++**finance预期数量:5个(原20+个)**++---++## 🏥 3. **medicine** - 医学++### 设计原则+医学文档标准化程度高,选择最通用的模板。++### 模板清单(5个)++##### 3.1 `treatment_map` - 治疗方案图++**用于文档**:临床实践指南、治疗方案文档、临床路径文件++**建模内容**:患者特征、诊断、治疗方案、适应症、禁忌组合、治疗结果++**可视化什么**:展示诊断→治疗→结果的决策路径,辅助临床决策支持系统(CDSS)++```yaml+type: hypergraph+核心要素:+ - patient: 患者特征+ - diagnosis: 诊断+ - treatment: 治疗方案+ - outcome: 治疗结果+关系:+ - indicates: 适应症+ - contraindicated_with: 禁忌组合+```++---++##### 3.2 `drug_interaction` - 药物相互作用图++**用于文档**:药品说明书、药物相互作用手册、临床药学文档++**建模内容**:药物A、药物B、相互作用类型(协同/拮抗)、作用机制、严重程度++**可视化什么**:展示多种药物之间的相互作用网络,辅助用药安全和药物重整++```yaml+type: graph+核心要素:+ - drug: 药物名称+ - drug_class: 药物类别+关系:+ - interacts_with: 相互作用(标注类型和严重程度)+ - contraindicated: 禁忌组合+```++---++##### 3.3 `anatomy_graph` - 解剖结构图++**用于文档**:解剖学教科书、解剖图谱、外科手术记录++**建模内容**:解剖结构名称、结构层级(系统→器官→组织→细胞)、位置++**可视化什么**:展示人体结构的层级包含关系和空间位置,辅助外科计划和医学教育++```yaml+type: graph+核心要素:+ - structure: 解剖结构+ - level: 层级(系统→器官→组织→细胞)+ - location: 空间位置+关系:+ - contains: 包含关系+ - located_in: 位于关系+```++---++##### 3.4 `hospital_timeline` - 住院病程时间线++**用于文档**:出院小结、病程记录、手术记录、会诊记录++**建模内容**:事件类型(入院/检查/手术/用药/出院)、事件日期、执行人、结果++**可视化什么**:展示患者住院期间的事件顺序,便于病历分析和质量控制++```yaml+type: temporal_graph+核心要素:+ - event: 事件(入院/检查/手术/用药/出院)+ - event_date: 发生日期+ - performer: 执行人+关系:+ - follows: 顺序关系+ - results_in: 结果关系+```++---++##### 3.5 `discharge_instruction` - 出院指导++**用于文档**:出院小结、患者教育材料、用药指导单++**建模内容**:用药列表及用法、随访安排、注意事项、警告信号++**可视化什么**:结构化呈现出院后患者需知内容,便于医患沟通和患者管理++```yaml+type: model+核心字段:+ - medications[]: 用药列表及用法+ - follow_up: 随访安排+ - restrictions: 注意事项+ - warning_signs[]: 警告信号+```++---++### 删除项+- ❌ `ComplexInteractionNet` → 合并到drug_interaction+- ❌ `PathologyHypergraph` → 合并到treatment_map+- ❌ `LevelOfEvidence` → 过于学术+- ❌ `MicroscopicFeatureSet` → 过于专业+- ❌ `TumorStagingItem` → 可作为treatment_map子集+- ❌ 其他10+个模板 → 删除++**medicine预期数量:5个(原15+个)**++---++## ⚖️ 4. **legal** - 法律++### 设计原则+法律文档逻辑严密,保留核心模板并简化。++### 模板清单(5个)++##### 4.1 `contract_obligation` - 合同义务图++**用于文档**:服务合同(MSA/SLA)、采购合同、租赁合同、劳动合同++**建模内容**:合同主体、义务内容、触发条件、例外情形、违约责任++**可视化什么**:展示合同中各方的权利义务关系、条件触发链,便于合同审查和履约监控++```yaml+type: hypergraph+核心要素:+ - party: 主体+ - obligation: 义务+ - trigger: 触发条件+ - exception: 例外情形+关系:+ - must_perform: 主体需履行+ - triggered_by: 条件触发+ - exempt_by: 例外免责+```++---++##### 4.2 `case_fact_timeline` - 案件事实时间线++**用于文档**:判决书、起诉状、答辩状、证据材料++**建模内容**:事实描述、发生日期、相关证据、是否争议、认定结果++**可视化什么**:展示案件事实的时间顺序和证据链,辅助诉讼分析++```yaml+type: temporal_graph+核心要素:+ - fact: 事实描述+ - date: 发生日期+ - evidence: 相关证据+ - disputed: 是否争议+关系:+ - preceded_by: 时间先后+ - proves: 证据支持+```++---++##### 4.3 `case_citation` - 判例引用图++**用于文档**:判决书、法律意见书、学术论文、判例汇编++**建模内容**:案件名称、引用条款、审理法院、判决结果++**可视化什么**:展示判例之间的引用关系和效力层级,辅助法律研究和先例分析++```yaml+type: graph+核心要素:+ - case: 案件名称+ - citation: 引用条款+ - court: 审理法院+关系:+ - cites: 引用关系+ - distinguished_from: 区分解释+ - overruled_by: 推翻+```++---++##### 4.4 `compliance_list` - 合规要求清单++**用于文档**:合规手册、法规汇编、审计报告、内控文档++**建模内容**:合规要求、依据法规、完成期限、责任人++**可视化什么**:结构化列出合规要求,便于合规审计和GAP分析++```yaml+type: list+核心字段:+ - requirement: 合规要求+ - regulation: 依据法规+ - deadline: 完成期限+ - responsible_party: 责任人+```++---++##### 4.5 `defined_term_set` - 定义术语集合++**用于文档**:合同(特别是英文合同)、法律意见书、法规定义章节++**建模内容**:定义术语、定义位置、含义摘要++**可视化什么**:提取合同中所有定义条款,便于术语一致性检查和快速理解++```yaml+type: set+核心要素:+ - term: 定义术语+ - defined_in: 定义位置+ - meaning: 含义摘要+```++---++### 删除项+- ❌ `AdjudicationLogic` → 过于复杂+- ❌ `BeneficialOwnershipGraph` → 合并到finance的ownership_graph+- ❌ `LiabilityClauseList` → 合并到contract_obligation+- ❌ 其他5+个模板 → 删除++**legal预期数量:5个(原10+个)**++---++## 🌿 5. **tcm** - 中医++### 设计原则+中医领域小众但专业,选择核心模板并增加关联图。++### 模板清单(5个)++##### 5.1 `formula_composition` - 方剂组成图++**用于文档**:经典方剂著作(《伤寒论》《金匮要略》)、现代方剂学教材、临床验方++**建模内容**:方剂名称、药材名称、角色(君/臣/佐/使)、剂量、配伍关系++**可视化什么**:展示方剂中各药材的角色分配和配伍关系,辅助方剂分析和药理研究++```yaml+type: hypergraph+核心要素:+ - formula: 方剂名称+ - herb: 药材名称+ - role: 角色(君/臣/佐/使)+ - dosage: 剂量+关系:+ - combines_with: 配伍关系+ - antagonizes: 相恶相反+```++---++##### 5.2 `syndrome_reasoning` - 证候推理图++**用于文档**:医案(医话/医论)、临床经验集、中医诊疗指南++**建模内容**:症状表现、证候类型、治法原则、推荐方剂++**可视化什么**:展示症状→证候→治法→方剂的推理链条,辅助辨证论治和经验挖掘++```yaml+type: hypergraph+核心要素:+ - symptom: 症状表现+ - syndrome: 证候类型+ - principle: 治法原则+ - formula: 推荐方剂+关系:+ - leads_to: 导致+ - treated_by: 治疗+```++---++##### 5.3 `meridian_graph` - 经络流注图++**用于文档**:针灸学教材、经络腧穴学、针灸临床指南++**建模内容**:穴位名称、所属经脉、位置描述、流注顺序++**可视化什么**:展示穴位在经脉上的分布和流注顺序,辅助针灸教学和临床取穴++```yaml+type: graph+核心要素:+ - acupoint: 穴位名称+ - meridian: 所属经脉+ - location: 位置描述+关系:+ - located_on: 位于经脉+ - flows_to: 流注顺序+```++---++##### 5.4 `herb_property` - 药材属性模型++**用于文档**:中药学教材(《神农本草经》《本草纲目》)、中药数据库、药品标准++**建模内容**:药材名称、四气、五味、归经、功效、毒性++**可视化什么**:结构化呈现药材的基本属性,便于中药数据库建设和临床查询++```yaml+type: model+核心字段:+ - name: 药材名称+ - nature: 四气(寒/热/温/凉)+ - flavor: 五味(酸/苦/甘/辛/咸)+ - meridian_entry: 归经+ - efficacy: 功效+ - toxicity: 毒性+```++---++##### 5.5 `herb_relation` - 药材关联图++**用于文档**:中药学教材、方剂学文献、临床用药指南、药对研究++**建模内容**:药材名称、关联类型(相须/相使/相畏/相杀/相恶/相反)、关联描述++**可视化什么**:展示药材之间的协同或对抗关系,辅助临床配伍和用药安全++```yaml+type: graph+核心要素:+ - herb: 药材名称+ - herb_property: 药材属性(可选)+关系:+ - synergizes: 相须/相使(协同)+ - reduces_toxicity: 相畏/相杀(减毒)+ - antagonizes: 相恶/相反(对抗)+```++---++### 删除项+- ❌ `AcupointLocationMap` → 合并到meridian_graph+- ❌ `PulseTongueRecord` → 过于细节+- ❌ `ProcessingMethod` → 可作为herb_property扩展+- ❌ 其他5+个模板 → 删除++**tcm预期数量:5个(原10+个)**++---++## ⚙️ 6. **industry** - 工业++### 设计原则+工业领域文档实用性强,保留操作相关模板。++### 模板清单(5个)++##### 6.1 `operation_flow` - 操作流程图++**用于文档**:SOP操作手册、设备操作规程、维修作业指导书++**建模内容**:操作步骤名称、步骤类型(动作/检查/切换)、设备状态、预期结果++**可视化什么**:展示操作的步骤顺序、状态变化和预期结果,辅助SOP可视化和操作培训++```yaml+type: graph+核心要素:+ - step: 操作步骤名称+ - step_type: 类型(动作/检查/切换)+ - equipment_state: 设备状态+ - expected_result: 预期结果+关系:+ - next: 顺序执行+ - triggers: 触发条件+ - results_in: 导致状态变化+```++---++##### 6.2 `safety_control` - 安全控制图++**用于文档**:安全管理手册、安全操作规程、风险评估报告、应急预案++**建模内容**:危险源、风险点、控制措施、责任角色++**可视化什么**:展示危险源→风险→控制措施的链条,辅助安全管理和审核++```yaml+type: graph+核心要素:+ - hazard: 危险源+ - risk_point: 风险点+ - control_measure: 控制措施+ - responsible_role: 责任角色+关系:+ - causes: 导致风险+ - mitigates: 减轻风险+ - assigned_to: 分配责任+```++---++##### 6.3 `failure_case` - 故障案例图++**用于文档**:故障分析报告、维修记录、设备履历、故障案例库++**建模内容**:故障现象、根本原因、纠正措施、预防措施、经验教训++**可视化什么**:展示故障现象→原因→措施的因果链,辅助故障诊断和经验积累++```yaml+type: graph+核心要素:+ - phenomenon: 故障现象+ - root_cause: 根本原因+ - corrective_action: 纠正措施+ - lesson: 经验教训+关系:+ - caused_by: 由...引起+ - resolved_by: 通过...解决+ - prevented_by: 预防措施+```++---++##### 6.4 `equipment_topology` - 设备拓扑图++**用于文档**:设备手册、系统设计文档、工厂布局图、备件清单++**建模内容**:设备名称、设备类型、安装位置、规格参数、连接关系++**可视化什么**:展示设备之间的物理连接和层级关系,辅助设备管理和系统理解++```yaml+type: graph+核心要素:+ - equipment: 设备名称+ - equipment_type: 设备类型+ - location: 安装位置+ - specifications: 规格参数+关系:+ - connected_to: 物理连接+ - located_in: 安装位置+ - contains: 包含关系+```++---++##### 6.5 `emergency_response` - 应急响应图++**用于文档**:应急预案、应急演练方案、事故处置规程++**建模内容**:事故场景、响应动作、责任人、响应顺序、资源需求++**可视化什么**:展示事故→响应动作→责任人的触发链,辅助应急演练和事故处置++```yaml+type: graph+核心要素:+ - scenario: 事故场景+ - action: 响应动作+ - responsible_role: 责任人+ - resource: 所需资源+关系:+ - triggers: 触发响应+ - executed_by: 执行责任人+ - requires: 所需资源+```++---++### 删除项+- ❌ `IncidentCausalityMap` → 合并到failure_case+- ❌ `SystemCompatibilityGraph` → 使用率低+- ❌ `PartReplacementList` → 过于细节+- ❌ `SystemTopologyGraph` → 与equipment_topology重复+- ❌ 其他10+个模板 → 删除++**industry预期数量:5个(原15+个)**++---++## 📊 重构预期效果++### 模板数量变化++| 领域 | 重构前 | 重构后 | 变化 |+|------|--------|--------|------|+| general | 14 | 13 | +4新增,-5删除 |+| finance | 20+ | 5 | -75% |+| medicine | 15+ | 5 | -67% |+| legal | 10+ | 5 | -50% |+| tcm | 10+ | 5 | -50% |+| industry | 15+ | 5 | -67% |+| **总计** | **80+** | **38** | **-53%** |++### 新增/重命名模板汇总++| 新模板 | 用途 | 来源 |+|--------|------|------|+| `workflow_graph` | 流程图(Skill/Workflow/SOP) | 新增 |+| `doc_structure` | 文档结构图 | 新增 |+| `biography_graph` | 传记图 | 重命名(life_event_timeline) |+| `concept_graph` | 概念关系图 | 重命名(concept_hierarchy) |+| `herb_relation` | 药材关联图 | 新增 |++---++## 🗓️ 实施计划++### Phase 1: 准备阶段+- [ ] 确认保留的base_*模板清单+- [ ] 制定各模板YAML格式规范+- [ ] 建立模板测试用例++### Phase 2: general领域(优先)+- [ ] workflow_graph+- [ ] doc_structure+- [ ] biography_graph+- [ ] concept_graph++### Phase 3: 其他领域精简+- [ ] finance:保留5个,删除15++- [ ] medicine:保留5个,删除10++- [ ] legal:保留5个,删除5++- [ ] tcm:保留5个,新增herb_relation,删除5++- [ ] industry:保留5个,删除10+++### Phase 4: legacy清理+- [ ] 将归档领域移至legacy/presets+- [ ] 清理Python模板(zh目录)+- [ ] 更新文档引用++### Phase 5: 验证与发布+- [ ] 运行模板测试+- [ ] 更新README+- [ ] 发布新版本++---++## 🤔 待确认事项++1. **workflow_graph的粒度**:+ - 是否需要支持嵌套的subskill/step?+ - 条件分支的表示方式?(if/else/loop)+ - 是否需要支持并行执行节点?++2. **biography_graph**:+ - 是否需要支持"人物关系"作为单独的关系类型?+ - 地点信息用spatial_graph还是作为event的属性?++3. **herb_relation关联类型**:+ - 是否需要区分"相须/相使/相畏/相杀/相恶/相反"?++4. **模板优先级**:哪些模板应该优先实现?++5. **legacy清理时机**:是现在清理还是分阶段?++---++## 📝 附录:GitHub热点参考++### 2026年3月Trending项目+| 项目 | Stars | 领域 |+|------|-------|------|+| DeerFlow | 47K | AI Agent |+| OpenClaw | 270K | AI Assistant |+| ruflo | 26K | Agent Orchestration |+| obra/superpowers | 15K | AI Coding OS |diff --git a/hyperextract/templates/presets/finance/.gitkeep b/hyperextract/templates/presets/finance/.gitkeepdeleted file mode 100644index e69de29..0000000diff --git a/hyperextract/templates/presets/finance/earnings_summary.yaml b/hyperextract/templates/presets/finance/earnings_summary.yamlnew file mode 100644index 0000000..e650ae9--- /dev/null+++ b/hyperextract/templates/presets/finance/earnings_summary.yaml@@ -0,0 +1,104 @@+language: [zh, en]++name: earnings_summary+type: model+tags: [finance, earnings, investor-relations]++description:+ zh: '财报会议摘要模板 - 从财报电话会议记录中提取公司业绩、预期对比和前瞻指引'+ en: 'Earnings Call Summary Template - Extract company performance, consensus comparison, and guidance from earnings call transcripts'++output:+ description:+ zh: '财报会议的核心内容和关键信息'+ en: 'Core content and key information from earnings calls'+ fields:+ - name: company_name+ type: str+ description:+ zh: '公司名称'+ en: 'Company name'+ required: true+ - name: quarter+ type: str+ description:+ zh: '财报季度,格式如"2024Q3"'+ en: 'Reporting quarter in format like "2024Q3"'+ required: true+ - name: reported_revenue+ type: str+ description:+ zh: '报告期实际营收'+ en: 'Reported revenue for the period'+ required: true+ - name: reported_eps+ type: str+ description:+ zh: '报告期实际每股收益'+ en: 'Reported earnings per share'+ required: true+ - name: revenue_vs_consensus+ type: str+ description:+ zh: '营收与市场预期的对比'+ en: 'Revenue comparison with market consensus'+ required: true+ - name: eps_vs_consensus+ type: str+ description:+ zh: '每股收益与市场预期的对比'+ en: 'EPS comparison with market consensus'+ required: true+ - name: guidance_revenue+ type: str+ description:+ zh: '营收前瞻指引'+ en: 'Revenue guidance'+ required: false+ - name: guidance_eps+ type: str+ description:+ zh: '每股收益前瞻指引'+ en: 'EPS guidance'+ required: false+ - name: overall_tone+ type: str+ description:+ zh: '管理层整体语调:积极/中性/消极'+ en: 'Overall management tone: positive/neutral/negative'+ required: true+ - name: key_highlights+ type: list+ description:+ zh: '本次会议的主要亮点'+ en: 'Key highlights from this call'+ required: false+ - name: key_concerns+ type: list+ description:+ zh: '本次会议的主要关切问题'+ en: 'Key concerns raised in this call'+ required: false++guideline:+ target:+ zh: '你是一位专业的投研分析师,负责从财报电话会议记录中准确提取业绩数据和关键信息。'+ en: 'You are a professional investment research analyst responsible for accurately extracting performance data and key information from earnings call transcripts.'+ rules:+ zh:+ - '提取精确的营收和EPS数字,确保与财报一致'+ - '对比数据应反映与市场共识预期的差异'+ - '前瞻指引应区分营收指引和EPS指引'+ - '语调评估应基于管理层措辞和信心程度'+ - '亮点和关切应提炼自会议讨论的核心议题'+ en:+ - 'Extract precise revenue and EPS figures, ensuring consistency with financial reports'+ - 'Comparison data should reflect the difference from market consensus expectations'+ - 'Guidance should distinguish between revenue and EPS guidance'+ - 'Tone assessment should be based on management language and confidence level'+ - 'Highlights and concerns should distill the core topics discussed in the call'++identifiers: {}++display:+ label: '{company_name} {quarter}'diff --git a/hyperextract/templates/presets/finance/event_timeline.yaml b/hyperextract/templates/presets/finance/event_timeline.yamlnew file mode 100644index 0000000..4ec0336--- /dev/null+++ b/hyperextract/templates/presets/finance/event_timeline.yaml@@ -0,0 +1,105 @@+language: [zh, en]++name: event_timeline+type: temporal_graph+tags: [finance, event, timeline, corporate-events]++description:+ zh: '重大事件时间线模板 - 从8-K报告、新闻稿和公司公告中提取公司重大事件的时间线'+ en: 'Major Events Timeline Template - Extract corporate major event timelines from 8-K reports, press releases, and company announcements'++output:+ description:+ zh: '公司重大事件的时间顺序和因果关系'+ en: 'Temporal order and causal relationships of corporate major events'+ entities:+ description:+ zh: '公司及其相关事件'+ en: 'Company and related events'+ fields:+ - name: name+ type: str+ description:+ zh: '公司或事件名称'+ en: 'Company or event name'+ required: true+ - name: entity_type+ type: str+ description:+ zh: '实体类型:公司/事件/公告类型'+ en: 'Entity type: company/event/announcement type'+ required: true+ relations:+ description:+ zh: '事件之间的时间顺序和因果关系'+ en: 'Temporal sequence and causal relationships between events'+ fields:+ - name: source+ type: str+ description:+ zh: '源实体名称'+ en: 'Source entity name'+ required: true+ - name: target+ type: str+ description:+ zh: '目标实体名称'+ en: 'Target entity name'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:precedes/causes/triggers'+ en: 'Relation type: precedes/causes/triggers'+ required: true+ - name: time+ type: str+ description:+ zh: '事件日期'+ en: 'Event date'+ required: true+ - name: description+ type: str+ description:+ zh: '事件说明,包括是否构成重大事项'+ en: 'Event description, including whether it constitutes a material event'+ required: false++guideline:+ target:+ zh: '你是一位专业的企业事件分析师,负责从公司披露文件中提取重大事件并构建时间线。'+ en: 'You are a professional corporate events analyst responsible for extracting major events and constructing timelines from company disclosure documents.'+ rules_for_entities:+ zh:+ - '提取公司名称作为核心实体'+ - '提取具有重大意义的事件作为实体'+ - '事件类型应反映事件的性质(公告/评级调整/业绩发布等)'+ en:+ - 'Extract company name as the core entity'+ - 'Extract events of significant meaning as entities'+ - 'Event type should reflect the nature of the event (announcement/rating adjustment/earnings release, etc.)'+ rules_for_relations:+ zh:+ - 'type为precedes表示事件的时间先后顺序'+ - 'type为causes表示因果关联'+ - 'type为triggers表示触发关系'+ - '仅提取文本中明确说明的关系'+ - 'description中应说明事件是否构成重大事项'+ en:+ - 'type precedes indicates temporal sequence of events'+ - 'type causes indicates causal connection'+ - 'type triggers indicates triggering relationship'+ - 'Only extract explicitly stated relationships in the text'+ - 'Description should indicate whether the event constitutes a material event'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}|{time}'+ relation_members:+ source: source+ target: target+ time_field: time++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/finance/ownership_graph.yaml b/hyperextract/templates/presets/finance/ownership_graph.yamlnew file mode 100644index 0000000..82514d9--- /dev/null+++ b/hyperextract/templates/presets/finance/ownership_graph.yaml@@ -0,0 +1,102 @@+language: [zh, en]++name: ownership_graph+type: graph+tags: [finance, corporate, ownership, shareholder]++description:+ zh: '股权结构图模板 - 从招股说明书和年报中提取股东持股关系和控制结构'+ en: 'Ownership Structure Graph Template - Extract shareholder ownership relationships and control structure from IPO prospectuses and annual reports'++output:+ description:+ zh: '公司股权层级结构和管理关系'+ en: 'Corporate ownership hierarchy and control relationships'+ entities:+ description:+ zh: '股东和公司实体'+ en: 'Shareholder and company entities'+ fields:+ - name: name+ type: str+ description:+ zh: '股东或公司名称'+ en: 'Shareholder or company name'+ required: true+ - name: shareholder_type+ type: str+ description:+ zh: '股东类型:机构投资者/个人/关联方/上市公司'+ en: 'Shareholder type: institutional investor/individual/related party/public company'+ required: true+ - name: description+ type: str+ description:+ zh: '股东或公司说明'+ en: 'Shareholder or company description'+ required: false+ relations:+ description:+ zh: '股东持股和控制关系'+ en: 'Shareholding and control relationships'+ fields:+ - name: source+ type: str+ description:+ zh: '控股股东名称'+ en: 'Controlling shareholder name'+ required: true+ - name: target+ type: str+ description:+ zh: '被控股公司名称'+ en: 'Controlled company name'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:controls/belongs_to/holds_shares'+ en: 'Relation type: controls/belongs_to/holds_shares'+ required: true+ - name: ownership_percentage+ type: str+ description:+ zh: '持股比例'+ en: 'Ownership percentage'+ required: false++guideline:+ target:+ zh: '你是一位专业的企业分析师,负责从IPO招股说明书和年报中准确提取股权结构信息。'+ en: 'You are a professional corporate analyst responsible for accurately extracting ownership structure information from IPO prospectuses and annual reports.'+ rules_for_entities:+ zh:+ - '提取具有独立法律地位的股东实体'+ - '股东类型应根据实际性质分类'+ - '机构投资者应标注具体类型(基金/保险/券商等)'+ en:+ - 'Extract shareholder entities with independent legal status'+ - 'Shareholder type should be classified based on actual nature'+ - 'Institutional investors should specify type (fund/insurance/securities, etc.)'+ rules_for_relations:+ zh:+ - '优先提取文本中明确描述的持股和控制关系'+ - '持股比例应与原文保持一致'+ - '注意区分直接持股和间接持股'+ - '仅提取文本中明确表达的关系'+ en:+ - 'Prioritize explicitly described shareholding and control relationships in the text'+ - 'Ownership percentage should match the source text'+ - 'Distinguish between direct and indirect shareholding'+ - 'Only extract relationships explicitly expressed in the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type} {ownership_percentage}'diff --git a/hyperextract/templates/presets/finance/risk_factor_set.yaml b/hyperextract/templates/presets/finance/risk_factor_set.yamlnew file mode 100644index 0000000..095405f--- /dev/null+++ b/hyperextract/templates/presets/finance/risk_factor_set.yaml@@ -0,0 +1,55 @@+language: [zh, en]++name: risk_factor_set+type: set+tags: [finance, risk, risk-management]++description:+ zh: '风险因子集合模板 - 从年报风险章节中提取和归类风险因子'+ en: 'Risk Factor Set Template - Extract and categorize risk factors from annual report risk sections'++output:+ description:+ zh: '归类后的风险因子清单'+ en: 'Categorized risk factor list'+ fields:+ - name: risk_factor+ type: str+ description:+ zh: '风险因子描述'+ en: 'Risk factor description'+ required: true+ - name: category+ type: str+ description:+ zh: '风险类别:经营风险/财务风险/市场风险/法规风险'+ en: 'Risk category: operational/financial/market/regulatory'+ required: true+ - name: severity+ type: str+ description:+ zh: '严重程度:高/中/低'+ en: 'Severity: high/medium/low'+ required: true++guideline:+ target:+ zh: '你是一位专业的风险分析师,负责从年报风险章节中准确提取和归类风险因子。'+ en: 'You are a professional risk analyst responsible for accurately extracting and categorizing risk factors from annual report risk sections.'+ rules:+ zh:+ - '提取的风险因子应完整保留原文的核心含义'+ - '风险类别应根据因子性质准确归类'+ - '严重程度应基于风险发生的可能性和影响程度评估'+ - '同一类型的风险因子应保持归类一致性'+ en:+ - 'Extracted risk factors should fully preserve the core meaning from the source text'+ - 'Risk category should be accurately classified based on the nature of the factor'+ - 'Severity should be assessed based on likelihood and impact of risk occurrence'+ - 'Risk factors of the same type should maintain classification consistency'++identifiers:+ item_id: risk_factor++display:+ label: '{risk_factor}'diff --git a/hyperextract/templates/presets/finance/sentiment_model.yaml b/hyperextract/templates/presets/finance/sentiment_model.yamlnew file mode 100644index 0000000..d0afa9d--- /dev/null+++ b/hyperextract/templates/presets/finance/sentiment_model.yaml@@ -0,0 +1,62 @@+language: [zh, en]++name: sentiment_model+type: model+tags: [finance, sentiment, market-analysis]++description:+ zh: '市场情绪模型模板 - 从财经新闻和市场评论中提取量化情绪指标'+ en: 'Market Sentiment Model Template - Extract quantified sentiment indicators from financial news and market commentary'++output:+ description:+ zh: '市场情绪的量化评估结果'+ en: 'Quantified market sentiment assessment result'+ fields:+ - name: sentiment_score+ type: float+ description:+ zh: '情绪分数,范围从-1(极度负面)到1(极度正面)'+ en: 'Sentiment score ranging from -1 (extremely negative) to 1 (extremely positive)'+ required: true+ - name: dominant_theme+ type: str+ description:+ zh: '主导市场主题'+ en: 'Dominant market theme'+ required: true+ - name: key_entities+ type: list+ description:+ zh: '文本中提到的关键实体(公司、行业、产品等)'+ en: 'Key entities mentioned in the text (companies, industries, products, etc.)'+ required: false+ - name: price_impact+ type: str+ description:+ zh: '对价格/市场的影响预测'+ en: 'Predicted impact on price/market'+ required: false++guideline:+ target:+ zh: '你是一位专业的市场情绪分析师,负责从财经文本中量化评估市场情绪。'+ en: 'You are a professional market sentiment analyst responsible for quantifying market sentiment from financial texts.'+ rules:+ zh:+ - '情绪分数应客观反映文本整体情绪倾向'+ - '-1到-0.3为负面,-0.3到0.3为中性,0.3到1为正面'+ - '主导主题应提炼文本的核心议题'+ - '关键实体应包括所有重要的公司和行业提及'+ - '价格影响应基于文本对市场的预期判断'+ en:+ - 'Sentiment score should objectively reflect the overall emotional tendency of the text'+ - '-1 to -0.3 is negative, -0.3 to 0.3 is neutral, 0.3 to 1 is positive'+ - 'Dominant theme should distill the core topic of the text'+ - 'Key entities should include all important company and industry mentions'+ - 'Price impact should be based on the text expectations for the market'++identifiers: {}++display:+ label: '{dominant_theme}'diff --git a/hyperextract/templates/presets/general/biography_graph.yaml b/hyperextract/templates/presets/general/biography_graph.yamlnew file mode 100644index 0000000..68adc6d--- /dev/null+++ b/hyperextract/templates/presets/general/biography_graph.yaml@@ -0,0 +1,110 @@+language: [zh, en]++name: biography_graph+type: temporal_graph+tags: [general, biography, life, events, timeline]++description:+ zh: '传记图模板 - 从人物传记、回忆录、年谱中提取实体和关系'+ en: 'Biography Graph Template - Extract entities and relationships from biographies, memoirs, and chronicles'++output:+ description:+ zh: '人物传记中的实体和关系网络'+ en: "Entity and relationship network from biographies"+ entities:+ description:+ zh: '传记中的实体'+ en: 'Entities in the biography'+ fields:+ - name: name+ type: str+ description:+ zh: '实体名称'+ en: 'Entity name'+ required: true+ - name: type+ type: str+ description:+ zh: '实体类型,如人物、地点、组织、作品、事件、成就等'+ en: 'Entity type, such as person, location, organization, work, event, achievement, etc.'+ required: true+ - name: description+ type: str+ description:+ zh: '实体描述'+ en: 'Entity description'+ required: false+ relations:+ description:+ zh: '实体之间的关系'+ en: 'Relationships between entities'+ fields:+ - name: source+ type: str+ description:+ zh: '关系起点实体'+ en: 'Source entity'+ required: true+ - name: target+ type: str+ description:+ zh: '关系终点实体'+ en: 'Target entity'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型,用简洁词语概括两个实体之间的连接方式'+ en: 'Relation type, concisely describing the connection between two entities'+ required: true+ - name: time+ type: str+ description:+ zh: '关系对应的时间;无明确时间时可留空'+ en: 'Time associated with the relation; can be left empty if no explicit time'+ required: false+ - name: description+ type: str+ description:+ zh: '对关系依据、方向或上下文含义的简要说明'+ en: 'Brief description of relation basis, direction, or contextual meaning'+ required: false++guideline:+ target:+ zh: '你是一位专业的传记分析师,擅长从人物传记、回忆录和年谱中提取实体和关系。'+ en: 'You are a professional biography analyst skilled at extracting entities and relationships from biographies, memoirs, and chronicles.'+ rules_for_entities:+ zh:+ - '提取传记主人公作为核心实体'+ - '相关人物包括:家人、朋友、同事、对手、历史人物等'+ - '同一实体在全文中保持命名一致'+ - '仅提取文本中明确表达的实体'+ en:+ - 'Extract the biographical subject as the core entity'+ - 'Related persons include: family, friends, colleagues, rivals, historical figures'+ - 'Maintain consistent naming for the same entity throughout the text'+ - 'Only extract entities explicitly expressed in the text'+ rules_for_relations:+ zh:+ - '提取对理解人物生平有重要意义的关系'+ - '仅在文本明确表达两个实体之间存在关系时创建关系'+ - '优先使用文本中明确出现的关系词'+ - '不要创建隐含的常识性关联'+ en:+ - 'Extract relationships of significant importance for understanding the person life'+ - 'Create relationships only when the text explicitly expresses a relationship between two entities'+ - 'Prefer relation words that explicitly appear in the text'+ - 'Do not create implicit common-sense associations'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/general/clause_list.yaml b/hyperextract/templates/presets/general/clause_list.yamldeleted file mode 100644index d78f9bb..0000000--- a/hyperextract/templates/presets/general/clause_list.yaml+++ /dev/null@@ -1,50 +0,0 @@-language: zh-name: clause_list-type: list-tags: [general]-description:- zh: '规章条文清单 - 将规章制度、操作手册或合规文本拆解为逐条的原子化条文,便于索引、检索、比对与问答。'--output:- description:- zh: '由逐条拆解后的规章条文组成的列表结果。'- fields:- - name: clauseId- type: str- description:- zh: '条文编号,如第1条、第2条、第2.1款、第3项等。'- - name: title- type: str- description:- zh: '条文标题、主题或该条的简短概括;原文未明确给出时可留空。'- required: false- default: ''- - name: content- type: str- description:- zh: '条文正文内容,尽量保持与原文一致,避免改写。'- - name: category- type: str- description:- zh: '条文分类,如总则、权利义务、程序、处罚、附则、其他。'- required: false- default: '其他'--guideline:- target:- zh: '你是一位专业的规章制度条文拆解专家。请将输入文本按其自然结构拆解为可独立引用、可检索的逐条条文。'- rules:- zh:- - '按原文的自然层级和编号结构拆解条文,如第X条、第X款、第X项等。'- - '每一项输出都应对应一个独立、可单独引用的条文单元。'- - 'clauseId 必须尽量使用原文中的编号;若原文无明确编号,可使用稳定且简洁的顺序标识。'- - 'content 应保留该条的核心正文,尽量与原文一致,不要总结式改写。'- - 'title 仅在原文明确存在标题、主题或能够从该条主旨中直接提炼时填写;否则留空。'- - 'category 需尽量归入总则、权利义务、程序、处罚、附则、其他之一。'- - '不要遗漏任何实质性条文,也不要把多个独立条文合并成一条。'- - '目录、页眉页脚、签章、编号噪音、纯格式性重复内容通常不作为条文输出。'--options: {}--display:- label: '{clauseId}({title})'diff --git a/hyperextract/templates/presets/general/compliance_logic.yaml b/hyperextract/templates/presets/general/compliance_logic.yamldeleted file mode 100644index eb66250..0000000--- a/hyperextract/templates/presets/general/compliance_logic.yaml+++ /dev/null@@ -1,117 +0,0 @@-language: zh-name: compliance_logic-type: hypergraph-tags: [general]-description:- zh: '规定条文超图 - 面向制度、细则、办法、规范、指引、规程等规定类文本,提取条文中涉及的名词性要素,并用 action 概括这些要素之间被要求执行的行为。'--output:- description:- zh: '由名词性实体节点和规定超边组成的结构化结果。节点只保留规定中涉及的人、部门、文件、场所、物品等要素;超边表示一条独立规定,action 用于概括这些要素之间被要求执行的行为。'- entities:- description:- zh: '规定涉及的基础节点。只提取名词或名词短语,不提取动作本身。'- fields:- - name: name- type: str- description:- zh: '实体名称,尽量直接使用原文中的稳定称呼;同一对象若同时出现全称、简称或缩写,应统一为一个名称。'- - name: category- type: str- description:- zh: '实体类型,应尽量使用清晰、稳定的名词类别,如人员、部门、组织、岗位、文件表单、证件、场所、设备、物品、时间要求、其他。'- - name: description- type: str- description:- zh: '用一句话说明该实体在当前规定中的含义或作用。'- required: false- default: ''- relations:- description:- zh: '表达规定条文的超边。每条超边对应一条独立规定,由相关实体构成,action 负责概括这些实体之间被要求执行的行为。'- fields:- - name: ruleType- type: str- description:- zh: '规定类型,用于概括该条规定在规定什么。优先使用:职责分工、行为要求、流程程序、其他。'- - name: participants- type: list- description:- zh: '构成该条规定基本内容的实体名称列表,必须直接使用已提取节点的 name。只放实体,不要把动作短语放进 participants。'- - name: action- type: str- description:- zh: '该条规定涉及的核心行为概括,用 1 句话说明这些实体之间被要求执行什么行为。action 承担行为表达,不要把 action 再拆成实体。'- - name: sourceClause- type: str- description:- zh: '规定来源的条款编号、标题或出处标识,尽量写最近的编号或小节定位。'- required: false- default: ''--guideline:- target:- zh: '你是一位规定条文结构化分析专家。请从规定类文本中提取每条规定涉及的名词性要素,并用 action 写清这些要素之间被要求执行的行为。'- rules_for_entities:- zh:- - '提取名词或名词短语形式的实体'- - '优先提取规定中真正参与行为的要素,如人员、岗位、部门、组织、文件表单、证件、场所、设备、物品、时间要求等。根据文本的具体内容和你的知识来决定具体的类别。'- - 'name 尽量保持原文中的稳定称呼;同一对象不要重复命名。'- - '如果某个词只是行为本身,例如“登记”“审批”“填写交接记录”,不要单独作为实体。'- - '对于“访客证”“登记表”“样品库”“前台”“每日18:00前”这类名词性短语,可以作为实体提取。'- - 'category 要尽量使用少数、容易理解的类别,不要为了细分而临时创造模糊类别。'- rules_for_relations:- zh:- - '每条超边只表达一条独立规定,并连接这条规定涉及的相关实体。'- - 'ruleType 优先使用:职责分工、行为要求、流程程序、其他。根据文本的具体内容和你的知识来决定具体的类别。'- - 'participants 必须直接引用已提取节点的 name,只放名词性实体,不放动作短语。'- - 'action 用 1 句话概括这条规定要求这些实体之间发生什么行为。'- - |- 完整示例(输入):- 1. 访客进入样品库前,应在前台登记并领取访客证。- 2. 安全部门每日18:00前回收当日访客证,并存档登记表。- - |- 完整示例(输出):- entities:- - name: 访客- category: 人员- description: 进入样品库并需履行登记要求的外来人员。- - name: 样品库- category: 场所- description: 访客进入前需要满足规定要求的区域。- - name: 前台- category: 场所- description: 办理登记和领取访客证的地点。- - name: 访客证- category: 证件- description: 访客登记后领取并在离开前回收的证件。- - name: 安全部门- category: 部门- description: 负责回收访客证并保存记录的管理部门。- - name: 登记表- category: 文件表单- description: 记录访客登记信息并需要存档的表单。- - name: 每日18:00前- category: 时间要求- description: 安全部门执行回收和存档要求的截止时间要求。- relations:- - ruleType: 流程程序- participants: [访客, 样品库, 前台, 访客证]- action: 规定访客进入样品库前,应在前台登记并领取访客证。- sourceClause: 1- - ruleType: 流程程序- participants: [安全部门, 访客证, 登记表, 每日18:00前]- action: 规定安全部门每日18:00前回收当日访客证,并存档登记表。- sourceClause: 2--identifiers:- entity_id: name- relation_id: '{sourceClause}|{ruleType}|{action}'- relation_members: participants--options:- extraction_mode: one_stage--display:- entity_label: '{name} ({category})'- relation_label: '[{ruleType}] {action}'diff --git a/hyperextract/templates/presets/general/concept_graph.yaml b/hyperextract/templates/presets/general/concept_graph.yamlnew file mode 100644index 0000000..2793b6c--- /dev/null+++ b/hyperextract/templates/presets/general/concept_graph.yaml@@ -0,0 +1,102 @@+language: [zh, en]++name: concept_graph+type: graph+tags: [general, concept, knowledge, taxonomy]++description:+ zh: '概念关系图模板 - 从教科书、百科全书、学术论文中提取概念层级关系和语义关联'+ en: 'Concept Graph Template - Extract concept hierarchy and semantic associations from textbooks, encyclopedias, and academic papers'++output:+ description:+ zh: '概念之间的层级关系和语义关联网络'+ en: 'Concept hierarchy and semantic association network'+ entities:+ description:+ zh: '文档中的核心概念'+ en: 'Core concepts in the document'+ fields:+ - name: name+ type: str+ description:+ zh: '概念名称'+ en: 'Concept name'+ required: true+ - name: type+ type: str+ description:+ zh: '概念类型:实体/抽象概念/过程/关系'+ en: 'Concept type: entity/abstract/process/relation'+ required: true+ - name: definition+ type: str+ description:+ zh: '概念的简要定义'+ en: 'Brief concept definition'+ required: false+ relations:+ description:+ zh: '概念之间的层级关系和语义关联'+ en: 'Hierarchy and semantic associations between concepts'+ fields:+ - name: source+ type: str+ description:+ zh: '源概念名称'+ en: 'Source concept name'+ required: true+ - name: target+ type: str+ description:+ zh: '目标概念名称'+ en: 'Target concept name'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型,用简洁词语概括两个概念之间的连接方式'+ en: 'Relation type, concisely describing the connection between two concepts'+ required: true+ - name: description+ type: str+ description:+ zh: '关系说明'+ en: 'Relation description'+ required: false++guideline:+ target:+ zh: '你是一位知识图谱专家,擅长从教科书、百科全书和学术论文中提取概念之间的层级关系和语义关联。'+ en: 'You are a knowledge graph expert skilled at extracting concept hierarchy and semantic associations from textbooks, encyclopedias, and academic papers.'+ rules_for_entities:+ zh:+ - '提取文档中定义的核心概念'+ - '概念名称应使用规范术语'+ - '同一概念在全文中保持命名一致'+ - '仅提取文本中明确表达的概念'+ en:+ - 'Extract core concepts defined in the document'+ - 'Concept names should use standard terminology'+ - 'Maintain consistent naming for the same concept throughout the text'+ - 'Only extract concepts explicitly expressed in the text'+ rules_for_relations:+ zh:+ - 'type用简洁词语概括关系性质'+ - '优先提取文档中明确定义的关系'+ - '不要创建隐含的常识性关联,仅提取文档中明确说明的关系'+ en:+ - 'Type should concisely describe the nature of the relationship'+ - 'Prioritize explicitly defined relationships in the document'+ - 'Do not create implicit common-sense associations, only extract explicitly stated relationships'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/general/concept_hierarchy.yaml b/hyperextract/templates/presets/general/concept_hierarchy.yamldeleted file mode 100644index 5d6e194..0000000--- a/hyperextract/templates/presets/general/concept_hierarchy.yaml+++ /dev/null@@ -1,78 +0,0 @@-language: zh-name: concept_hierarchy-type: graph-tags: [general]-description:- zh: '概念层级图谱模板 - 从教材、百科、定义说明等文本中提取概念及其层次结果的组成或实例化关系,用于构建稳定的概念结构。'--output:- description:- zh: '由概念节点和层级关系边组成的结构化结果,用于表达概念体系中的分类、组成与实例关系。'- entities:- description:- zh: '文本中出现并可进入概念结构的节点。'- fields:- - name: name- type: str- description:- zh: '概念名称、术语名称或实例名称,优先使用原文中的稳定叫法。'- - name: category- type: str- description:- zh: '概念所属专业类别,需要通过文中内容归纳并结合你的常识进行判断'- - name: description- type: str- description:- zh: '对该概念的简要说明,可概括其定义、范围或在当前结构中的作用。'- required: false- default: ''- relations:- description:- zh: '概念之间的层级或结构关系边。'- fields:- - name: source- type: str- description:- zh: '关系起点,通常为上位概念、整体概念或被实例化的概念。'- - name: target- type: str- description:- zh: '关系终点,通常为下位概念、组成部分或实例。'- - name: relation_type- type: str- description:- zh: '层次关系类型,使用具体层级关系词'- - name: details- type: str- description:- zh: '对关系方向、限定条件或上下文的简要补充。'- required: false- default: ''--guideline:- target:- 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: one_stage--display:- entity_label: '{name} ({category})'- relation_label: '{relation_type}'diff --git a/hyperextract/templates/presets/general/cross_reference_net.yaml b/hyperextract/templates/presets/general/cross_reference_net.yamldeleted file mode 100644index 42b9da1..0000000--- a/hyperextract/templates/presets/general/cross_reference_net.yaml+++ /dev/null@@ -1,81 +0,0 @@-language: zh-name: cross_reference_net-type: graph-tags: [general]-description:- zh: '交叉引用网络模板 - 从百科、文档、规章或知识说明类文本中提取条目之间的引用、参见、链接或相关关系。'--output:- description:- zh: '由条目节点和交叉引用关系组成的网络结构,用于表达文本中的引用路径和知识跳转关系。'- entities:- description:- zh: '可作为引用发起方或引用目标的条目、概念或章节节点。'- fields:- - name: name- type: str- description:- zh: '条目、概念、章节或被引用对象的名称。'- - name: type- type: str- description:- zh: '节点类型,如条目、章节、概念、人物、地点、其他。'- - name: description- type: str- description:- zh: '对节点含义或其在当前引用网络中角色的简要说明。'- required: false- default: ''- relations:- description:- zh: '节点之间的交叉引用关系边。'- fields:- - name: source- type: str- description:- zh: '引用发起方,即当前条目、章节或概念。'- - name: target- type: str- description:- zh: '被引用、被链接、被参见或被关联的目标节点。'- - name: relation_type- type: str- description:- zh: '关系类型,优先使用超链接、引用、参见、相关、其他。'- - name: context- type: str- description:- zh: '对引用语境、引用目的或上下文位置的简要补充。'- required: false- default: ''--guideline:- target:- zh: '你是一位知识网络分析专家。请从文本中提取可独立识别的条目或概念,并建立它们之间明确存在的引用、参见或相关连接。'- rules_for_entities:- zh:- - '优先提取在文本中被明确提及、并能够作为引用源或引用目标的条目、概念、章节、人物或地点。'- - 'name 使用原文中最清晰、最稳定的称呼;同一对象保持统一命名。'- - 'type 需概括节点身份,如条目、章节、概念、人物、地点、其他。'- - 'description 可用于说明该节点为何会进入当前引用网络;信息不足时可留空。'- rules_for_relations:- zh:- - '仅在文本明确存在引用、超链接、参见、相关提示或互指关系时建立边。'- - 'source 和 target 必须直接引用已提取节点的 name。'- - 'relation_type 优先使用超链接、引用、参见、相关、其他,并尽量与文本表达保持一致。'- - '若引用关系带有特定上下文、说明语或引用目的,可写入 context;否则留空。'- - '不要把仅仅共同出现、主题相近但没有显式互指的节点误判为交叉引用关系。'--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/presets/general/doc_structure.yaml b/hyperextract/templates/presets/general/doc_structure.yamlnew file mode 100644index 0000000..5fcd66c--- /dev/null+++ b/hyperextract/templates/presets/general/doc_structure.yaml@@ -0,0 +1,110 @@+language: [zh, en]++name: doc_structure+type: graph+tags: [general, document, structure, knowledge]++description:+ zh: '文档结构图模板 - 从技术文档、论文、报告中提取章节层级结构和交叉引用关系'+ en: 'Document Structure Template - Extract chapter hierarchy and cross-reference relationships from technical documents, papers, and reports'++output:+ description:+ zh: '文档的章节层级结构和引用关系网络'+ en: 'Document chapter hierarchy and reference relationship network'+ entities:+ description:+ zh: '文档中的章节和内容节点'+ en: 'Chapter and content nodes in the document'+ fields:+ - name: title+ type: str+ description:+ zh: '章节标题或内容标识'+ en: 'Chapter title or content identifier'+ required: true+ - name: node_type+ type: str+ description:+ zh: '节点类型:章/节/小节/段落/代码/表格/图表'+ en: 'Node type: chapter/section/subsection/paragraph/code/table/figure'+ required: true+ - name: level+ type: int+ description:+ zh: '层级深度,从1开始(1=章,2=节,3=小节...)'+ en: 'Hierarchy level starting from 1 (1=chapter, 2=section, 3=subsection...)'+ required: true+ - name: summary+ type: str+ description:+ zh: '章节内容摘要'+ en: 'Chapter content summary'+ required: false+ relations:+ description:+ zh: '章节之间的包含关系和交叉引用'+ en: 'Containment relationships and cross-references between chapters'+ fields:+ - name: source+ type: str+ description:+ zh: '源节点标题'+ en: 'Source node title'+ required: true+ - name: target+ type: str+ description:+ zh: '目标节点标题'+ en: 'Target node title'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型,用简洁词语概括两个节点之间的连接方式'+ en: 'Relation type, concisely describing the connection between two nodes'+ required: true+ - name: reference_context+ type: str+ description:+ zh: '引用上下文说明(如"如图3.2所示")'+ en: 'Reference context (e.g., "as shown in Figure 3.2")'+ required: false++guideline:+ target:+ zh: '你是一位技术文档分析师,擅长从技术文档、论文和报告中提取结构化的章节层级和引用关系。'+ en: 'You are a technical document analyst skilled at extracting structured chapter hierarchy and reference relationships from technical documents, papers, and reports.'+ rules_for_entities:+ zh:+ - '提取所有具有独立标题的章节作为节点'+ - 'code类型节点应标注代码片段的主要功能'+ - 'table和figure类型节点应标注表格/图表的主题'+ - 'level值应与文档实际层级结构一致'+ - 'summary应概括该章节的核心内容,不超过50字'+ en:+ - 'Extract all chapters with independent titles as nodes'+ - 'code type nodes should indicate the main functionality of code snippets'+ - 'table and figure type nodes should indicate the subject of the table/figure'+ - 'level values should match the actual document hierarchy'+ - 'summary should summarize the core content of the chapter, not exceeding 50 characters'+ rules_for_relations:+ zh:+ - 'type用简洁词语概括关系性质'+ - '仅提取文档中明确标记的引用关系(如"见第X章"、"如图X所示")'+ - '不要创建隐含的语义关联,仅提取显式的引用关系'+ en:+ - 'Type should concisely describe the nature of the relationship'+ - 'Only extract explicitly marked reference relationships (e.g., "see Chapter X", "as shown in Figure X")'+ - 'Do not create implicit semantic associations, only explicit reference relationships'++identifiers:+ entity_id: title+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{title}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/general/life_event_timeline.yaml b/hyperextract/templates/presets/general/life_event_timeline.yamldeleted file mode 100644index ccc5902..0000000--- a/hyperextract/templates/presets/general/life_event_timeline.yaml+++ /dev/null@@ -1,104 +0,0 @@-language: zh-name: biographical_timeline-type: temporal_graph-tags: [general]-description:- zh: '人物生平时间线 - 从传记、自传、回忆录等人物叙事文本中提取带时间的生平事件,并组织为时间线。'--output:- description:- zh: '由人物相关实体和生平事件关系组成的时间线结果,用于还原人物经历、角色变化与关键转折。'- entities:- description:- zh: '文本中与人物生平相关、可作为事件端点的实体。'- fields:- - name: name- type: str- description:- zh: '实体在文本中的稳定名称或常用称呼。'- - name: type- type: str- description:- zh: '实体类型,如人物、地点、组织、作品、奖项、身份、物品、概念、其他。'- - name: description- type: str- description:- zh: '对实体身份、角色或在当前文本中作用的简要说明。'- required: false- relations:- description:- zh: '围绕人物经历构建的事件关系边。'- fields:- - name: source- type: str- description:- zh: '事件发起者或经历者,通常为人物主体或触发事件的相关实体。'- - name: target- type: str- description:- zh: '与该事件直接相关的对象实体,如地点、学校、组织、人物、作品、奖项等。'- - name: eventType- type: str- description:- zh: '事件类型。使用能够概括事件本身的简洁词语或短语,优先具体、直观、可区分;通常可用动词,如出生、入学、任职、结婚、出版、获奖。可参考示例,但不必局限于示例,也可以根据文本语义自行创造更贴切的标签。'- - name: eventDate- type: str- description:- zh: '事件时间。优先保留文本中最精确的时间表达;可为年份、年月、年月日,必要时可保留时间段。'- required: false- - name: details- type: str- description:- zh: '事件补充说明,可记录身份、地点、机构、结果或上下文。'- required: false--guideline:- target:- zh: '你是一位专业的人物传记事件抽取专家。请围绕人物主体,从文本中提取与其生平经历直接相关的实体和事件,并构建可信的时间线。'- rules_for_entities:- zh:- - '优先提取与人物主体生平经历直接相关的实体,如人物、地点、组织、作品、奖项、身份称谓等。'- - '为每个实体指定尽量准确的类型,并优先使用文本中的稳定称呼。'- - '不必为纯背景概念、空泛评价或无法成为事件端点的内容单独建实体。'- rules_for_relations:- zh:- - '仅从已提取实体中创建事件边,source 和 target 都必须对应实体 name。'- - '事件应代表可放入人物时间线的经历、转折、公开活动或身份变化,不要把纯评价、性格描述或静态背景知识当作事件。'- - '若一句话包含多个独立事件,应拆分为多条关系;若同一事件同时涉及时间、地点、组织、身份,可在 details 中补充。'- - 'eventType 应使用能够概括事件本身的简洁词语或短语,优先具体、直观、可区分;通常可用动词或动宾结构。'- - '优先写贴近原文语义的具体标签,不要过度抽象。例如优先写“入学、毕业、留学”而不是“教育”,优先写“任职、升迁、离任”而不是“工作”,优先写“出版、获奖、发明”而不是“成就”。'- - '可参考但不限于以下示例:出生、逝世、迁居、入学、毕业、任职、结婚、合作、出版、获奖、参战、归国、隐居。'- - '允许根据文本语义自行创造更贴切的标签,例如拜师、出道、登基、封侯、退赛、复出等;不要求必须使用示例中的词。'- - '仅在确实无法提炼出更具体的事件标签时,才使用较泛的词。'- - '时间信息为可选,仅在文本明确给出或能根据明确相对时间可靠换算时才填写。'- rules_for_time:- zh:- - '当前观察日期:{observation_time}'- - '相对时间解析(基于观察日期):'- - '- "去年" → {observation_time} 前一年'- - '- "今年" → {observation_time} 所属年份'- - '- "明年" → {observation_time} 后一年'- - '- "昨天/今天/明天" → {observation_time} 前/当/后一天'- - '- "十年前/五年后" → {observation_time} 前/后相应年数'- - '- "年初/年末" → 当年 1月1日/12月31日'- - '- "朝代" → 保留朝代名称'- - '明确时间:优先保留文本中最精确的原始格式'- - '- 年份(如 429年、2023年)→ 429、2023'- - '- 年-月、年-月-日、时间段(如 1937-1945)→ 保持原格式'- - '若只有模糊阶段性表达且无法可靠换算,不要强行补时间'- - '缺失时间:留空'--identifiers:- entity_id: name- relation_id: '{source}|{target}'- 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/presets/general/social_network.yaml b/hyperextract/templates/presets/general/social_network.yamldeleted file mode 100644index cfdc3b5..0000000--- a/hyperextract/templates/presets/general/social_network.yaml+++ /dev/null@@ -1,87 +0,0 @@-language: zh-name: social_network-type: graph-tags: [general]-description:- zh: '社会关系网络模板 - 从人物叙事、组织介绍、历史材料或新闻文本中提取人物与组织之间的人际和隶属关系。'--output:- description:- zh: '由人物、组织等节点及其关系边组成的社会关系网络结构。'- entities:- description:- zh: '人际关系网络中的人物、组织或机构节点。'- fields:- - name: name- type: str- description:- zh: '人物、组织或机构的名称。'- - name: type- type: str- description:- zh: '节点类型,如人物、组织、机构、团体、其他。'- - name: description- type: str- description:- zh: '对节点身份或其在网络中作用的简要说明。'- required: false- default: ''- - name: role- type: str- description:- zh: '该节点在当前文本中的角色、身份或职位。'- required: false- default: ''- relations:- description:- zh: '人物与人物、人物与组织、组织与组织之间的社会关系边。'- fields:- - name: source- type: str- description:- zh: '关系起点节点。'- - name: target- type: str- description:- zh: '关系终点节点。'- - name: relation_type- type: str- description:- zh: '关系类型,如亲属、朋友、同事、师生、上下级、合作、竞争、隶属、其他。'- - name: details- type: str- description:- zh: '对关系依据、互动方式或上下文的简要补充。'- required: false- default: ''--guideline:- target:- zh: '你是一位社会关系分析专家。请从文本中提取人物、组织及其明确存在的人际关系或组织隶属关系。'- rules_for_entities:- zh:- - '优先提取对关系网络有意义的人物、组织、机构或团体节点。'- - 'name 使用文本中最稳定、最清晰的称呼;同一对象保持统一命名。'- - 'type 概括节点类别,role 用于补充其在当前文本中的身份或职位;没有则留空。'- - 'description 可说明该节点为何重要或其在关系网络中的作用;信息不足时留空。'- rules_for_relations:- zh:- - '仅在文本明确表达两节点之间存在社会关系、合作关系、竞争关系或组织隶属时建立边。'- - 'source 和 target 必须直接引用已提取节点的 name。'- - 'relation_type 优先使用亲属、朋友、同事、师生、上下级、合作、竞争、隶属、其他。'- - 'details 可用于补充关系背景、时间段或互动情境;没有额外信息时留空。'- - '不要把共同出现、共同被提及但无明确互动的对象误判为存在关系。'--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} ({role})'- relation_label: '{relation_type}'diff --git a/hyperextract/templates/presets/general/workflow_graph.yaml b/hyperextract/templates/presets/general/workflow_graph.yamlnew file mode 100644index 0000000..2e897eb--- /dev/null+++ b/hyperextract/templates/presets/general/workflow_graph.yaml@@ -0,0 +1,122 @@+language: [zh, en]++name: workflow_graph+type: temporal_graph+tags: [general, workflow, process, agent, skill]++description:+ zh: '工作流程图模板 - 从Skill定义文件、Agent工作流文档、SOP操作手册中提取流程步骤及其执行顺序、依赖关系和条件分支'+ en: 'Workflow Graph Template - Extract workflow steps, execution order, dependencies, and conditional branches from Skill definitions, Agent workflow documents, and SOP manuals'++output:+ description:+ zh: '工作流程的步骤节点及其执行关系'+ en: 'Workflow steps and their execution relationships'+ entities:+ description:+ zh: '工作流程中的步骤节点'+ en: 'Step nodes in the workflow'+ fields:+ - name: name+ type: str+ description:+ zh: '步骤名称,使用清晰的动作性描述'+ en: 'Step name with clear action-oriented description'+ required: true+ - name: type+ type: str+ description:+ zh: '步骤类型:调用技能/普通步骤/条件判断/分支节点'+ en: 'Step type: skill/step/condition/branch'+ required: true+ - name: description+ type: str+ description:+ zh: '步骤的简要功能描述'+ en: 'Brief description of step functionality'+ required: false+ - name: input+ type: str+ description:+ zh: '步骤的输入要求'+ en: 'Input requirements for the step'+ required: false+ - name: output+ type: str+ description:+ zh: '步骤的输出结果'+ en: 'Output result of the step'+ required: false+ relations:+ description:+ zh: '步骤之间的执行顺序、依赖关系和条件分支'+ en: 'Execution order, dependencies, and conditional branches between steps'+ fields:+ - name: source+ type: str+ description:+ zh: '源步骤名称'+ en: 'Source step name'+ required: true+ - name: target+ type: str+ description:+ zh: '目标步骤名称'+ en: 'Target step name'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型,用简洁词语概括两个步骤之间的连接方式'+ en: 'Relation type, concisely describing the connection between two steps'+ required: true+ - name: condition+ type: str+ description:+ zh: '条件表达式(如分支条件)'+ en: 'Condition expression (e.g., branch condition)'+ required: false+ - name: description+ type: str+ description:+ zh: '关系说明,如分支条件或触发原因'+ en: 'Relation description such as branch condition or trigger reason'+ required: false++guideline:+ target:+ zh: '你是一位工作流分析师,擅长从Skill定义文档、Agent工作流说明和SOP操作手册中提取流程结构。'+ en: 'You are a workflow analyst skilled at extracting process structures from Skill definitions, Agent workflow documentation, and SOP manuals.'+ rules_for_entities:+ zh:+ - '提取每个具有独立功能的步骤作为节点'+ - '同一步骤在文档中保持命名一致'+ - '仅提取文档中明确描述的步骤'+ - 'input/output应简洁描述数据流向'+ en:+ - 'Extract each functionally independent step as a node'+ - 'Maintain consistent naming for the same step throughout the document'+ - 'Only extract steps explicitly described in the document'+ - 'input/output should concisely describe data flow'+ rules_for_relations:+ zh:+ - '仅在文档明确表达两个步骤之间存在关系时创建关系'+ - '优先使用文档中明确出现的关系词'+ - '不要创建隐含的因果关系'+ - '并行执行可用相应关系类型表示'+ en:+ - 'Create relations only when the document explicitly expresses a relationship between two steps'+ - 'Prefer relation words that explicitly appear in the document'+ - 'Do not create implicit causal relationships'+ - 'Parallel execution can be represented using appropriate relation type'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/industry/.gitkeep b/hyperextract/templates/presets/industry/.gitkeepdeleted file mode 100644index e69de29..0000000diff --git a/hyperextract/templates/presets/industry/emergency_response.yaml b/hyperextract/templates/presets/industry/emergency_response.yamlnew file mode 100644index 0000000..9a3a417--- /dev/null+++ b/hyperextract/templates/presets/industry/emergency_response.yaml@@ -0,0 +1,100 @@+language: [zh, en]++name: emergency_response+type: graph+tags: [industry, emergency, response, safety]++description:+ zh: '应急响应图模板 - 从应急预案中提取事故场景、响应动作和责任人的关系'+ en: 'Emergency Response Graph Template - Extract relationships between accident scenarios, response actions, and responsible persons from emergency plans'++output:+ description:+ zh: '事故到响应动作到责任人的触发链'+ en: 'Accident to response action to responsible person trigger chain'+ entities:+ description:+ zh: '应急响应要素'+ en: 'Emergency response elements'+ fields:+ - name: name+ type: str+ description:+ zh: '要素名称'+ en: 'Element name'+ required: true+ - name: type+ type: str+ description:+ zh: '要素类型:事故场景/响应动作/资源'+ en: 'Element type: accident scenario/response action/resource'+ required: true+ - name: description+ type: str+ description:+ zh: '说明'+ en: 'Description'+ required: false+ relations:+ description:+ zh: '事故、响应动作和责任人的关系'+ en: 'Relationships between accidents, response actions, and responsible persons'+ fields:+ - name: source+ type: str+ description:+ zh: '源要素'+ en: 'Source element'+ required: true+ - name: target+ type: str+ description:+ zh: '目标要素'+ en: 'Target element'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:triggers/executed_by/requires'+ en: 'Relation type: triggers/executed_by/requires'+ required: true+ - name: responsible_role+ type: str+ description:+ zh: '责任角色'+ en: 'Responsible role'+ required: false++guideline:+ target:+ zh: '你是一位专业的应急管理专家,负责从应急预案中准确提取应急响应关系。'+ en: 'You are a professional emergency management expert responsible for accurately extracting emergency response relationships from emergency plans.'+ rules_for_entities:+ zh:+ - '提取事故场景作为实体'+ - '提取响应动作作为实体'+ - '提取所需资源作为实体'+ en:+ - 'Extract accident scenarios as entities'+ - 'Extract response actions as entities'+ - 'Extract required resources as entities'+ rules_for_relations:+ zh:+ - 'type为triggers表示触发响应'+ - 'type为executed_by表示执行责任人'+ - 'type为requires表示所需资源'+ en:+ - 'type triggers indicates triggering response'+ - 'type executed_by indicates executing responsible person'+ - 'type requires indicates required resources'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/industry/equipment_topology.yaml b/hyperextract/templates/presets/industry/equipment_topology.yamlnew file mode 100644index 0000000..f618c1c--- /dev/null+++ b/hyperextract/templates/presets/industry/equipment_topology.yaml@@ -0,0 +1,98 @@+language: [zh, en]++name: equipment_topology+type: graph+tags: [industry, equipment, topology, system]++description:+ zh: '设备拓扑图模板 - 从设备手册中提取设备之间的物理连接和层级关系'+ en: 'Equipment Topology Graph Template - Extract physical connections and hierarchical relationships between equipment from equipment manuals'++output:+ description:+ zh: '设备之间的物理连接和层级关系'+ en: 'Physical connections and hierarchical relationships between equipment'+ entities:+ description:+ zh: '设备实体'+ en: 'Equipment entities'+ fields:+ - name: name+ type: str+ description:+ zh: '设备名称'+ en: 'Equipment name'+ required: true+ - name: type+ type: str+ description:+ zh: '设备类型'+ en: 'Equipment type'+ required: true+ - name: location+ type: str+ description:+ zh: '安装位置'+ en: 'Installation location'+ required: false+ - name: specifications+ type: str+ description:+ zh: '规格参数'+ en: 'Specifications'+ required: false+ relations:+ description:+ zh: '设备之间的连接和层级关系'+ en: 'Connection and hierarchical relationships between equipment'+ fields:+ - name: source+ type: str+ description:+ zh: '源设备'+ en: 'Source equipment'+ required: true+ - name: target+ type: str+ description:+ zh: '目标设备'+ en: 'Target equipment'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:connected_to/located_in/contains'+ en: 'Relation type: connected_to/located_in/contains'+ required: true++guideline:+ target:+ zh: '你是一位专业的设备工程师,负责从设备手册中准确提取设备拓扑关系。'+ en: 'You are a professional equipment engineer responsible for accurately extracting equipment topology relationships from equipment manuals.'+ rules_for_entities:+ zh:+ - '提取设备名称作为实体'+ - '设备类型应准确分类'+ - '安装位置应标注具体的物理位置'+ en:+ - 'Extract equipment names as entities'+ - 'Equipment types should be accurately classified'+ - 'Installation locations should indicate specific physical locations'+ rules_for_relations:+ zh:+ - '优先提取设备手册中明确描述的设备关系'+ - '仅提取文本中明确表达的设备关系'+ en:+ - 'Prioritize explicitly described equipment relationships from equipment manuals'+ - 'Only extract equipment relationships explicitly expressed in the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/industry/failure_case.yaml b/hyperextract/templates/presets/industry/failure_case.yamlnew file mode 100644index 0000000..965919d--- /dev/null+++ b/hyperextract/templates/presets/industry/failure_case.yaml@@ -0,0 +1,102 @@+language: [zh, en]++name: failure_case+type: graph+tags: [industry, failure, maintenance, troubleshooting]++description:+ zh: '故障案例图模板 - 从故障分析报告中提取故障现象、原因和措施的因果关系'+ en: 'Failure Case Graph Template - Extract failure phenomenon-cause-measure causal relationships from failure analysis reports'++output:+ description:+ zh: '故障现象到原因到措施的因果链'+ en: 'Failure phenomenon to cause to measure causal chain'+ entities:+ description:+ zh: '故障要素'+ en: 'Failure elements'+ fields:+ - name: name+ type: str+ description:+ zh: '要素名称'+ en: 'Element name'+ required: true+ - name: type+ type: str+ description:+ zh: '要素类型:故障现象/原因/措施'+ en: 'Element type: phenomenon/cause/measure'+ required: true+ - name: description+ type: str+ description:+ zh: '说明'+ en: 'Description'+ required: false+ relations:+ description:+ zh: '故障要素之间的因果关系'+ en: 'Causal relationships between failure elements'+ fields:+ - name: source+ type: str+ description:+ zh: '前置要素'+ en: 'Prior element'+ required: true+ - name: target+ type: str+ description:+ zh: '后续要素'+ en: 'Subsequent element'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:caused_by/resolved_by/prevented_by'+ en: 'Relation type: caused_by/resolved_by/prevented_by'+ required: true+ - name: lesson+ type: str+ description:+ zh: '经验教训'+ en: 'Lessons learned'+ required: false++guideline:+ target:+ zh: '你是一位专业的设备工程师,负责从故障分析报告中准确提取故障因果关系。'+ en: 'You are a professional equipment engineer responsible for accurately extracting failure causal relationships from failure analysis reports.'+ rules_for_entities:+ zh:+ - '提取故障现象作为实体'+ - '提取根本原因作为实体'+ - '提取纠正措施作为实体'+ en:+ - 'Extract failure phenomena as entities'+ - 'Extract root causes as entities'+ - 'Extract corrective measures as entities'+ rules_for_relations:+ zh:+ - 'type为caused_by表示由某原因引起'+ - 'type为resolved_by表示通过某措施解决'+ - 'type为prevented_by表示通过某措施预防'+ - 'lesson字段应总结经验教训'+ en:+ - 'type caused_by indicates caused by a reason'+ - 'type resolved_by indicates resolved by a measure'+ - 'type prevented_by indicates prevented by a measure'+ - 'Lesson field should summarize lessons learned'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/industry/operation_flow.yaml b/hyperextract/templates/presets/industry/operation_flow.yamlnew file mode 100644index 0000000..5170e40--- /dev/null+++ b/hyperextract/templates/presets/industry/operation_flow.yaml@@ -0,0 +1,108 @@+language: [zh, en]++name: operation_flow+type: graph+tags: [industry, operation, sop, workflow]++description:+ zh: '操作流程图模板 - 从SOP操作手册中提取操作步骤和流程关系'+ en: 'Operation Flow Graph Template - Extract operation steps and flow relationships from SOP manuals'++output:+ description:+ zh: '操作步骤的流程关系'+ en: 'Operation step flow relationships'+ entities:+ description:+ zh: '操作步骤'+ en: 'Operation steps'+ fields:+ - name: name+ type: str+ description:+ zh: '步骤名称'+ en: 'Step name'+ required: true+ - name: type+ type: str+ description:+ zh: '步骤类型:动作/检查/切换'+ en: 'Step type: action/inspection/switch'+ required: true+ - name: equipment_state+ type: str+ description:+ zh: '设备状态'+ en: 'Equipment state'+ required: false+ - name: expected_result+ type: str+ description:+ zh: '预期结果'+ en: 'Expected result'+ required: false+ relations:+ description:+ zh: '步骤之间的执行关系'+ en: 'Execution relationships between steps'+ fields:+ - name: source+ type: str+ description:+ zh: '前置步骤'+ en: 'Prior step'+ required: true+ - name: target+ type: str+ description:+ zh: '后续步骤'+ en: 'Subsequent step'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:next/triggers/results_in'+ en: 'Relation type: next/triggers/results_in'+ required: true+ - name: description+ type: str+ description:+ zh: '关系说明'+ en: 'Relationship description'+ required: false++guideline:+ target:+ zh: '你是一位专业的操作工程师,负责从SOP操作手册中准确提取操作流程关系。'+ en: 'You are a professional operation engineer responsible for accurately extracting operation flow relationships from SOP manuals.'+ rules_for_entities:+ zh:+ - '提取每个具有独立功能的操作步骤作为实体'+ - '步骤类型应准确分类'+ - '设备状态应标注关键状态变化'+ en:+ - 'Extract each operation step with independent function as entity'+ - 'Step types should be accurately classified'+ - 'Equipment states should indicate key state changes'+ rules_for_relations:+ zh:+ - 'type为next表示顺序执行'+ - 'type为triggers表示触发条件'+ - 'type为results_in表示导致状态变化'+ - '仅提取文档中明确说明的关系'+ en:+ - 'type next indicates sequential execution'+ - 'type triggers indicates trigger condition'+ - 'type results_in indicates state change'+ - 'Only extract explicitly stated relationships from the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/industry/safety_control.yaml b/hyperextract/templates/presets/industry/safety_control.yamlnew file mode 100644index 0000000..d29352a--- /dev/null+++ b/hyperextract/templates/presets/industry/safety_control.yaml@@ -0,0 +1,102 @@+language: [zh, en]++name: safety_control+type: graph+tags: [industry, safety, hazard, control]++description:+ zh: '安全控制图模板 - 从安全管理手册中提取危险源、风险和控制措施的关系'+ en: 'Safety Control Graph Template - Extract hazard-risk-control relationships from safety management manuals'++output:+ description:+ zh: '危险源到风险到控制措施的关系链条'+ en: 'Hazard to risk to control measure relationship chain'+ entities:+ description:+ zh: '安全要素'+ en: 'Safety elements'+ fields:+ - name: name+ type: str+ description:+ zh: '要素名称'+ en: 'Element name'+ required: true+ - name: type+ type: str+ description:+ zh: '要素类型:危险源/风险点/控制措施'+ en: 'Element type: hazard/risk point/control measure'+ required: true+ - name: description+ type: str+ description:+ zh: '说明'+ en: 'Description'+ required: false+ relations:+ description:+ zh: '危险源、风险和控制措施的关系'+ en: 'Relationships between hazards, risks, and control measures'+ fields:+ - name: source+ type: str+ description:+ zh: '源要素'+ en: 'Source element'+ required: true+ - name: target+ type: str+ description:+ zh: '目标要素'+ en: 'Target element'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:causes/mitigates/assigned_to'+ en: 'Relation type: causes/mitigates/assigned_to'+ required: true+ - name: responsible_role+ type: str+ description:+ zh: '责任角色'+ en: 'Responsible role'+ required: false++guideline:+ target:+ zh: '你是一位专业的安全工程师,负责从安全管理手册中准确提取安全控制关系。'+ en: 'You are a professional safety engineer responsible for accurately extracting safety control relationships from safety management manuals.'+ rules_for_entities:+ zh:+ - '提取危险源作为实体'+ - '提取风险点作为实体'+ - '提取控制措施作为实体'+ en:+ - 'Extract hazards as entities'+ - 'Extract risk points as entities'+ - 'Extract control measures as entities'+ rules_for_relations:+ zh:+ - 'type为causes表示导致风险'+ - 'type为mitigates表示减轻风险'+ - 'type为assigned_to表示责任分配'+ - 'responsible_role应标注具体的责任人或部门'+ en:+ - 'type causes indicates causing risk'+ - 'type mitigates indicates mitigating risk'+ - 'type assigned_to indicates responsibility assignment'+ - 'Responsible role should indicate specific responsible person or department'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/legal/.gitkeep b/hyperextract/templates/presets/legal/.gitkeepdeleted file mode 100644index e69de29..0000000diff --git a/hyperextract/templates/presets/legal/case_citation.yaml b/hyperextract/templates/presets/legal/case_citation.yamlnew file mode 100644index 0000000..94f45bc--- /dev/null+++ b/hyperextract/templates/presets/legal/case_citation.yaml@@ -0,0 +1,102 @@+language: [zh, en]++name: case_citation+type: graph+tags: [legal, case, citation, precedent]++description:+ zh: '判例引用图模板 - 从判决书和法律意见书中提取判例引用关系'+ en: 'Case Citation Graph Template - Extract case citation relationships from judgments and legal opinions'++output:+ description:+ zh: '判例之间的引用关系网络'+ en: 'Citation relationship network between cases'+ entities:+ description:+ zh: '案件和引用条款'+ en: 'Cases and cited provisions'+ fields:+ - name: name+ type: str+ description:+ zh: '案件名称或条款编号'+ en: 'Case name or provision number'+ required: true+ - name: type+ type: str+ description:+ zh: '实体类型:案件/条款/法规'+ en: 'Entity type: case/provision/regulation'+ required: true+ - name: court+ type: str+ description:+ zh: '审理法院'+ en: 'Adjudicating court'+ required: false+ relations:+ description:+ zh: '案件之间的引用和效力关系'+ en: 'Citation and authority relationships between cases'+ fields:+ - name: source+ type: str+ description:+ zh: '引用方'+ en: 'Citing case'+ required: true+ - name: target+ type: str+ description:+ zh: '被引用方'+ en: 'Cited case'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:cites/distinguished_from/overruled_by'+ en: 'Relation type: cites/distinguished_from/overruled_by'+ required: true+ - name: description+ type: str+ description:+ zh: '引用说明'+ en: 'Citation description'+ required: false++guideline:+ target:+ zh: '你是一位专业的法律研究员,负责从判决书和法律意见书中准确提取判例引用关系。'+ en: 'You are a professional legal researcher responsible for accurately extracting case citation relationships from judgments and legal opinions.'+ rules_for_entities:+ zh:+ - '提取案件名称作为核心实体'+ - '条款实体应包含完整的条款编号'+ - '法院信息应准确标注'+ en:+ - 'Extract case names as core entities'+ - 'Provision entities should include complete provision numbers'+ - 'Court information should be accurately labeled'+ rules_for_relations:+ zh:+ - 'type为cites表示引用关系'+ - 'type为distinguished_from表示区分解释'+ - 'type为overruled_by表示被推翻'+ - '仅提取文本中明确提及的引用关系'+ en:+ - 'type cites indicates citation relationship'+ - 'type distinguished_from indicates distinguishing explanation'+ - 'type overruled_by indicates being overruled'+ - 'Only extract citation relationships explicitly mentioned in the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/legal/case_fact_timeline.yaml b/hyperextract/templates/presets/legal/case_fact_timeline.yamlnew file mode 100644index 0000000..f495568--- /dev/null+++ b/hyperextract/templates/presets/legal/case_fact_timeline.yaml@@ -0,0 +1,109 @@+language: [zh, en]++name: case_fact_timeline+type: temporal_graph+tags: [legal, case, fact, timeline]++description:+ zh: '案件事实时间线模板 - 从判决书和证据材料中提取案件事实的时间线'+ en: 'Case Fact Timeline Template - Extract case fact timelines from judgments and evidence materials'++output:+ description:+ zh: '案件事实的时间顺序和证据链'+ en: 'Temporal sequence of case facts and evidence chain'+ entities:+ description:+ zh: '案件事实和证据'+ en: 'Case facts and evidence'+ fields:+ - name: name+ type: str+ description:+ zh: '事实描述或证据编号'+ en: 'Fact description or evidence number'+ required: true+ - name: type+ type: str+ description:+ zh: '实体类型:事实/证据'+ en: 'Entity type: fact/evidence'+ required: true+ - name: description+ type: str+ description:+ zh: '详细描述'+ en: 'Detailed description'+ required: false+ relations:+ description:+ zh: '事实之间的时间顺序和证据支持关系'+ en: 'Temporal sequence and evidence support relationships between facts'+ fields:+ - name: source+ type: str+ description:+ zh: '前置事实'+ en: 'Prior fact'+ required: true+ - name: target+ type: str+ description:+ zh: '后续事实'+ en: 'Subsequent fact'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:preceded_by/proves/disputes'+ en: 'Relation type: preceded_by/proves/disputes'+ required: true+ - name: time+ type: str+ description:+ zh: '事实发生日期'+ en: 'Fact occurrence date'+ required: false+ - name: disputed+ type: str+ description:+ zh: '是否争议:是/否'+ en: 'Whether disputed: yes/no'+ required: false++guideline:+ target:+ zh: '你是一位专业的诉讼分析师,负责从判决书和证据材料中准确提取案件事实并构建时间线。'+ en: 'You are a professional litigation analyst responsible for accurately extracting case facts and constructing timelines from judgments and evidence materials.'+ rules_for_entities:+ zh:+ - '提取关键的案件事实作为实体'+ - '证据实体应包含证据编号和来源'+ - '实体描述应精炼准确'+ en:+ - 'Extract key case facts as entities'+ - 'Evidence entities should include evidence number and source'+ - 'Entity descriptions should be concise and accurate'+ rules_for_relations:+ zh:+ - 'type为preceded_by表示时间先后顺序'+ - 'type为proves表示证据支持'+ - 'type为disputes表示对某一事实存在争议'+ - '仅提取文本中明确陈述的事实关系'+ en:+ - 'type preceded_by indicates temporal sequence'+ - 'type proves indicates evidence support'+ - 'type disputes indicates dispute over a fact'+ - 'Only extract explicitly stated fact relationships from the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target+ time_field: time++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/legal/compliance_list.yaml b/hyperextract/templates/presets/legal/compliance_list.yamlnew file mode 100644index 0000000..2ac2649--- /dev/null+++ b/hyperextract/templates/presets/legal/compliance_list.yaml@@ -0,0 +1,60 @@+language: [zh, en]++name: compliance_list+type: list+tags: [legal, compliance, regulation]++description:+ zh: '合规要求清单模板 - 从合规手册和审计报告中提取结构化的合规要求'+ en: 'Compliance Requirements List Template - Extract structured compliance requirements from compliance manuals and audit reports'++output:+ description:+ zh: '合规要求和监管事项清单'+ en: 'List of compliance requirements and regulatory items'+ fields:+ - name: requirement+ type: str+ description:+ zh: '合规要求描述'+ en: 'Compliance requirement description'+ required: true+ - name: regulation+ type: str+ description:+ zh: '依据法规'+ en: 'Basis regulation'+ required: true+ - name: deadline+ type: str+ description:+ zh: '完成期限'+ en: 'Completion deadline'+ required: false+ - name: responsible_party+ type: str+ description:+ zh: '责任人或责任部门'+ en: 'Responsible party or department'+ required: false++guideline:+ target:+ zh: '你是一位专业的合规分析师,负责从合规文档中准确提取结构化的合规要求。'+ en: 'You are a professional compliance analyst responsible for accurately extracting structured compliance requirements from compliance documents.'+ rules:+ zh:+ - '提取的合规要求应完整保留原文的核心含义'+ - '依据法规应标注具体的法规名称和条款'+ - '完成期限应明确标注时间节点'+ - '责任人应尽可能具体到部门或个人'+ en:+ - 'Extracted compliance requirements should fully preserve the core meaning from the source text'+ - 'Basis regulations should specify the specific regulation name and clause'+ - 'Completion deadlines should clearly indicate time milestones'+ - 'Responsible parties should be as specific as possible to department or individual'++identifiers: {}++display:+ label: '{requirement}'diff --git a/hyperextract/templates/presets/legal/contract_obligation.yaml b/hyperextract/templates/presets/legal/contract_obligation.yamlnew file mode 100644index 0000000..d7ef394--- /dev/null+++ b/hyperextract/templates/presets/legal/contract_obligation.yaml@@ -0,0 +1,100 @@+language: [zh, en]++name: contract_obligation+type: hypergraph+tags: [legal, contract, obligation, parties]++description:+ zh: '合同义务图模板 - 从服务合同和采购合同中提取各方的权利义务关系'+ en: 'Contract Obligation Graph Template - Extract rights and obligations of all parties from service contracts and procurement contracts'++output:+ description:+ zh: '合同中各方的权利义务关系网络'+ en: 'Network of rights and obligations of all parties in the contract'+ entities:+ description:+ zh: '合同主体和义务要素'+ en: 'Contract parties and obligation elements'+ fields:+ - name: name+ type: str+ description:+ zh: '主体名称或义务要素'+ en: 'Party name or obligation element'+ required: true+ - name: type+ type: str+ description:+ zh: '实体类型:当事人/义务/条件/例外'+ en: 'Entity type: party/obligation/condition/exception'+ required: true+ relations:+ description:+ zh: '合同义务的触发和履行关系'+ en: 'Triggering and performance relationships of contract obligations'+ fields:+ - name: party+ type: list+ description:+ zh: '涉及的一方或多方当事人'+ en: 'One or more parties involved'+ required: true+ - name: obligation+ type: str+ description:+ zh: '具体义务内容'+ en: 'Specific obligation content'+ required: true+ - name: trigger+ type: str+ description:+ zh: '义务触发条件'+ en: 'Obligation trigger condition'+ required: false+ - name: exception+ type: str+ description:+ zh: '例外情形'+ en: 'Exception situations'+ required: false+ - name: type+ type: str+ description:+ zh: '关系类型:must_perform/triggered_by/exempt_by'+ en: 'Relation type: must_perform/triggered_by/exempt_by'+ required: true++guideline:+ target:+ zh: '你是一位专业的合同律师,负责从服务合同和采购合同中准确提取各方的权利义务关系。'+ en: 'You are a professional contract lawyer responsible for accurately extracting rights and obligations of all parties from service contracts and procurement contracts.'+ rules_for_entities:+ zh:+ - '提取所有合同当事人作为实体'+ - '提取核心义务要素作为实体'+ - '条件要素和例外情形应单独标注'+ en:+ - 'Extract all contract parties as entities'+ - 'Extract core obligation elements as entities'+ - 'Condition elements and exceptions should be separately labeled'+ rules_for_relations:+ zh:+ - '优先提取文本中明确描述的义务关系'+ - '义务触发条件和例外情形应单独标注'+ - 'party字段应包含所有涉及的当事人'+ - '仅提取文本中明确表达的义务关系'+ en:+ - 'Prioritize explicitly described obligation relationships in the text'+ - 'Obligation trigger conditions and exception situations should be separately labeled'+ - 'Party field should include all parties involved'+ - 'Only extract obligation relationships explicitly expressed in the text'++identifiers:+ entity_id: name+ relation_id: '{obligation}|{type}'+ relation_members: party++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/legal/defined_term_set.yaml b/hyperextract/templates/presets/legal/defined_term_set.yamlnew file mode 100644index 0000000..9204afd--- /dev/null+++ b/hyperextract/templates/presets/legal/defined_term_set.yaml@@ -0,0 +1,55 @@+language: [zh, en]++name: defined_term_set+type: set+tags: [legal, contract, terminology]++description:+ zh: '定义术语集合模板 - 从合同和法律文书中提取术语定义'+ en: 'Defined Term Set Template - Extract term definitions from contracts and legal documents'++output:+ description:+ zh: '合同中的术语定义集合'+ en: 'Set of term definitions in contracts'+ fields:+ - name: term+ type: str+ description:+ zh: '被定义的术语'+ en: 'Defined term'+ required: true+ - name: defined_in+ type: str+ description:+ zh: '定义所在位置(如条款编号)'+ en: 'Location of definition (e.g., clause number)'+ required: true+ - name: meaning+ type: str+ description:+ zh: '术语含义摘要'+ en: 'Summary of term meaning'+ required: true++guideline:+ target:+ zh: '你是一位专业的法律文书分析师,负责从合同中准确提取术语定义。'+ en: 'You are a professional legal document analyst responsible for accurately extracting term definitions from contracts.'+ rules:+ zh:+ - '提取所有明确定义的术语'+ - '定义位置应标注具体的条款或章节'+ - '含义摘要应精炼概括核心定义'+ - '同一术语的多次定义应合并'+ en:+ - 'Extract all explicitly defined terms'+ - 'Definition location should specify the specific clause or section'+ - 'Meaning summary should concisely summarize the core definition'+ - 'Multiple definitions of the same term should be merged'++identifiers:+ item_id: term++display:+ label: '{term}'diff --git a/hyperextract/templates/presets/medicine/.gitkeep b/hyperextract/templates/presets/medicine/.gitkeepdeleted file mode 100644index e69de29..0000000diff --git a/hyperextract/templates/presets/medicine/anatomy_graph.yaml b/hyperextract/templates/presets/medicine/anatomy_graph.yamlnew file mode 100644index 0000000..5c598f6--- /dev/null+++ b/hyperextract/templates/presets/medicine/anatomy_graph.yaml@@ -0,0 +1,94 @@+language: [zh, en]++name: anatomy_graph+type: graph+tags: [medicine, anatomy, structure, body]++description:+ zh: '解剖结构图模板 - 从解剖学教材中提取人体结构的层级关系'+ en: 'Anatomy Structure Graph Template - Extract hierarchical relationships of human body structures from anatomy textbooks'++output:+ description:+ zh: '人体结构的层级包含关系'+ en: 'Hierarchical containment relationships of human body structures'+ entities:+ description:+ zh: '解剖结构实体'+ en: 'Anatomical structure entities'+ fields:+ - name: name+ type: str+ description:+ zh: '解剖结构名称'+ en: 'Anatomical structure name'+ required: true+ - name: level+ type: str+ description:+ zh: '结构层级:系统/器官/组织/细胞'+ en: 'Structure level: system/organ/tissue/cell'+ required: true+ - name: location+ type: str+ description:+ zh: '空间位置'+ en: 'Spatial location'+ required: false+ relations:+ description:+ zh: '解剖结构之间的包含和位置关系'+ en: 'Containment and location relationships between anatomical structures'+ fields:+ - name: source+ type: str+ description:+ zh: '父级结构'+ en: 'Parent structure'+ required: true+ - name: target+ type: str+ description:+ zh: '子级结构'+ en: 'Child structure'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:contains/located_in'+ en: 'Relation type: contains/located_in'+ required: true++guideline:+ target:+ zh: '你是一位专业的解剖学专家,负责从解剖学教材中准确提取人体结构的层级关系。'+ en: 'You are a professional anatomy expert responsible for accurately extracting hierarchical relationships of human body structures from anatomy textbooks.'+ rules_for_entities:+ zh:+ - '提取具有明确解剖学定义的实体'+ - '结构层级应与解剖学标准一致'+ - '位置信息应准确描述'+ en:+ - 'Extract entities with clear anatomical definitions'+ - 'Structure levels should be consistent with anatomical standards'+ - 'Location information should be accurately described'+ rules_for_relations:+ zh:+ - '优先提取解剖学教材中明确描述的结构关系'+ - '层级关系应遵循解剖学分类体系'+ - '仅提取文本中明确表达的结构关系'+ en:+ - 'Prioritize explicitly described structural relationships from anatomy textbooks'+ - 'Hierarchical relationships should follow anatomical classification system'+ - 'Only extract structural relationships explicitly expressed in the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/medicine/discharge_instruction.yaml b/hyperextract/templates/presets/medicine/discharge_instruction.yamlnew file mode 100644index 0000000..6a1c65f--- /dev/null+++ b/hyperextract/templates/presets/medicine/discharge_instruction.yaml@@ -0,0 +1,60 @@+language: [zh, en]++name: discharge_instruction+type: model+tags: [medicine, hospital, discharge, patient-care]++description:+ zh: '出院指导模板 - 从出院小结中提取患者出院后需知的医疗指导信息'+ en: 'Discharge Instruction Template - Extract post-discharge medical guidance information from discharge summaries'++output:+ description:+ zh: '患者出院后医疗指导'+ en: 'Post-discharge medical guidance for patients'+ fields:+ - name: medications+ type: list+ description:+ zh: '用药列表及用法'+ en: 'Medication list and usage instructions'+ required: true+ - name: follow_up+ type: str+ description:+ zh: '随访安排'+ en: 'Follow-up arrangement'+ required: true+ - name: restrictions+ type: list+ description:+ zh: '注意事项'+ en: 'Things to note'+ required: false+ - name: warning_signs+ type: list+ description:+ zh: '警告信号(需立即就医的情况)'+ en: 'Warning signs (situations requiring immediate medical attention)'+ required: false++guideline:+ target:+ zh: '你是一位专业的医疗文档分析师,负责从出院小结中准确提取患者出院后需知的医疗指导信息。'+ en: 'You are a professional medical document analyst responsible for accurately extracting post-discharge medical guidance information from discharge summaries.'+ rules:+ zh:+ - '用药列表应包含药物名称、剂量和用法'+ - '随访安排应明确标注时间节点'+ - '注意事项应包括饮食、运动等生活指导'+ - '警告信号应列举需立即就医的紧急情况'+ en:+ - 'Medication list should include drug name, dosage, and usage'+ - 'Follow-up arrangement should clearly indicate time milestones'+ - 'Things to note should include lifestyle guidance such as diet and exercise'+ - 'Warning signs should list emergency situations requiring immediate medical attention'++identifiers: {}++display:+ label: '出院指导'diff --git a/hyperextract/templates/presets/medicine/drug_interaction.yaml b/hyperextract/templates/presets/medicine/drug_interaction.yamlnew file mode 100644index 0000000..19ec754--- /dev/null+++ b/hyperextract/templates/presets/medicine/drug_interaction.yaml@@ -0,0 +1,108 @@+language: [zh, en]++name: drug_interaction+type: graph+tags: [medicine, drug, interaction, pharmacy]++description:+ zh: '药物相互作用图模板 - 从药品说明书中提取药物之间的相互作用关系'+ en: 'Drug Interaction Graph Template - Extract drug-drug interaction relationships from drug labels and interaction manuals'++output:+ description:+ zh: '药物相互作用网络'+ en: 'Drug interaction network'+ entities:+ description:+ zh: '药物实体'+ en: 'Drug entities'+ fields:+ - name: name+ type: str+ description:+ zh: '药物名称'+ en: 'Drug name'+ required: true+ - name: drug_class+ type: str+ description:+ zh: '药物类别'+ en: 'Drug class'+ required: false+ - name: description+ type: str+ description:+ zh: '药物说明'+ en: 'Drug description'+ required: false+ relations:+ description:+ zh: '药物之间的相互作用'+ en: 'Interactions between drugs'+ fields:+ - name: source+ type: str+ description:+ zh: '药物A名称'+ en: 'Drug A name'+ required: true+ - name: target+ type: str+ description:+ zh: '药物B名称'+ en: 'Drug B name'+ required: true+ - name: type+ type: str+ description:+ zh: '相互作用类型:协同/拮抗/禁用'+ en: 'Interaction type: synergistic/antagonistic/contraindicated'+ required: true+ - name: mechanism+ type: str+ description:+ zh: '作用机制'+ en: 'Mechanism of action'+ required: false+ - name: severity+ type: str+ description:+ zh: '严重程度:高/中/低'+ en: 'Severity: high/medium/low'+ required: true++guideline:+ target:+ zh: '你是一位专业的临床药师,负责从药品说明书中准确提取药物相互作用信息。'+ en: 'You are a professional clinical pharmacist responsible for accurately extracting drug interaction information from drug labels.'+ rules_for_entities:+ zh:+ - '提取药物通用名称作为实体'+ - '药物类别应准确标注'+ - '避免重复的药物实体'+ en:+ - 'Extract generic drug names as entities'+ - 'Drug classes should be accurately labeled'+ - 'Avoid duplicate drug entities'+ rules_for_relations:+ zh:+ - '优先提取药品说明书中明确描述的药物相互作用'+ - '严重程度应基于临床风险评估'+ - '避免重复的相互作用记录'+ - '仅提取文本中明确表达的相互作用'+ en:+ - 'Prioritize explicitly described drug interactions from drug labels'+ - 'Severity should be based on clinical risk assessment'+ - 'Avoid duplicate interaction records'+ - 'Only extract interactions explicitly expressed in the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/medicine/hospital_timeline.yaml b/hyperextract/templates/presets/medicine/hospital_timeline.yamlnew file mode 100644index 0000000..b4310b4--- /dev/null+++ b/hyperextract/templates/presets/medicine/hospital_timeline.yaml@@ -0,0 +1,107 @@+language: [zh, en]++name: hospital_timeline+type: temporal_graph+tags: [medicine, hospital, timeline, clinical]++description:+ zh: '住院病程时间线模板 - 从病程记录和手术记录中提取患者住院期间的事件时间线'+ en: 'Hospital Timeline Template - Extract patient in-hospital event timelines from clinical notes and surgical records'++output:+ description:+ zh: '患者住院期间的事件顺序'+ en: 'Sequence of patient in-hospital events'+ entities:+ description:+ zh: '医疗事件'+ en: 'Medical events'+ fields:+ - name: name+ type: str+ description:+ zh: '事件名称'+ en: 'Event name'+ required: true+ - name: type+ type: str+ description:+ zh: '事件类型:入院/检查/手术/用药/会诊/出院'+ en: 'Event type: admission/examination/surgery/medication/consultation/discharge'+ required: true+ - name: description+ type: str+ description:+ zh: '事件描述'+ en: 'Event description'+ required: false+ relations:+ description:+ zh: '事件之间的顺序和结果关系'+ en: 'Sequence and result relationships between events'+ fields:+ - name: source+ type: str+ description:+ zh: '前置事件'+ en: 'Prior event'+ required: true+ - name: target+ type: str+ description:+ zh: '后续事件'+ en: 'Subsequent event'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:follows/results_in'+ en: 'Relation type: follows/results_in'+ required: true+ - name: time+ type: str+ description:+ zh: '事件发生日期'+ en: 'Event date'+ required: true+ - name: performer+ type: str+ description:+ zh: '执行人'+ en: 'Performer'+ required: false++guideline:+ target:+ zh: '你是一位专业的医疗分析师,负责从病程记录中准确提取患者住院期间的事件时间线。'+ en: 'You are a professional medical analyst responsible for accurately extracting patient in-hospital event timelines from clinical notes.'+ rules_for_entities:+ zh:+ - '提取关键的医疗事件作为实体'+ - '事件类型应准确分类'+ - '描述应精炼概括事件内容'+ en:+ - 'Extract key medical events as entities'+ - 'Event types should be accurately classified'+ - 'Descriptions should concisely summarize event content'+ rules_for_relations:+ zh:+ - 'type为follows表示事件的时序关系'+ - 'type为results_in表示因果结果关系'+ - 'performer应标注执行人或科室'+ en:+ - 'type follows indicates temporal sequence of events'+ - 'type results_in indicates causal result relationship'+ - 'Performer should indicate the executor or department'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}|{time}'+ relation_members:+ source: source+ target: target+ time_field: time++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/medicine/treatment_map.yaml b/hyperextract/templates/presets/medicine/treatment_map.yamlnew file mode 100644index 0000000..38d70c3--- /dev/null+++ b/hyperextract/templates/presets/medicine/treatment_map.yaml@@ -0,0 +1,106 @@+language: [zh, en]++name: treatment_map+type: hypergraph+tags: [medicine, treatment, clinical, decision]++description:+ zh: '治疗方案图模板 - 从临床指南中提取诊断、治疗和结果的映射关系'+ en: 'Treatment Map Template - Extract diagnosis-treatment-outcome mapping relationships from clinical guidelines'++output:+ description:+ zh: '诊断治疗决策路径'+ en: 'Diagnosis-treatment decision paths'+ entities:+ description:+ zh: '患者特征和治疗要素'+ en: 'Patient characteristics and treatment elements'+ fields:+ - name: name+ type: str+ description:+ zh: '要素名称'+ en: 'Element name'+ required: true+ - name: type+ type: str+ description:+ zh: '要素类型:患者特征/诊断/治疗/结果'+ en: 'Element type: patient characteristic/diagnosis/treatment/outcome'+ required: true+ - name: description+ type: str+ description:+ zh: '要素描述'+ en: 'Element description'+ required: false+ relations:+ description:+ zh: '诊断、治疗和结果之间的映射关系'+ en: 'Mapping relationships between diagnosis, treatment, and outcomes'+ fields:+ - name: conditions+ type: list+ description:+ zh: '适用条件/患者特征'+ en: 'Applicable conditions/patient characteristics'+ required: false+ - name: diagnosis+ type: str+ description:+ zh: '诊断结果'+ en: 'Diagnosis result'+ required: true+ - name: treatment+ type: str+ description:+ zh: '治疗方案'+ en: 'Treatment plan'+ required: true+ - name: outcome+ type: str+ description:+ zh: '治疗结果'+ en: 'Treatment outcome'+ required: false+ - name: type+ type: str+ description:+ zh: '关系类型:indicates/contraindicated_with'+ en: 'Relation type: indicates/contraindicated_with'+ required: true++guideline:+ target:+ zh: '你是一位专业的临床专家,负责从临床指南中准确提取治疗方案映射关系。'+ en: 'You are a professional clinical expert responsible for accurately extracting treatment mapping relationships from clinical guidelines.'+ rules_for_entities:+ zh:+ - '提取患者特征作为实体'+ - '提取诊断结果作为实体'+ - '提取治疗方案作为实体'+ - '提取治疗结果作为实体'+ en:+ - 'Extract patient characteristics as entities'+ - 'Extract diagnosis results as entities'+ - 'Extract treatment plans as entities'+ - 'Extract treatment outcomes as entities'+ rules_for_relations:+ zh:+ - 'type为indicates表示适应症'+ - 'type为contraindicated_with表示禁忌组合'+ - 'conditions字段应包含所有相关的患者特征/适用条件'+ en:+ - 'type indicates indicates indication'+ - 'type contraindicated_with indicates contraindicated combination'+ - 'Conditions field should include all relevant patient characteristics/applicable conditions'++identifiers:+ entity_id: name+ relation_id: '{diagnosis}|{type}|{treatment}'+ relation_members: conditions++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/tcm/.gitkeep b/hyperextract/templates/presets/tcm/.gitkeepdeleted file mode 100644index e69de29..0000000diff --git a/hyperextract/templates/presets/tcm/formula_composition.yaml b/hyperextract/templates/presets/tcm/formula_composition.yamlnew file mode 100644index 0000000..5fc3a4d--- /dev/null+++ b/hyperextract/templates/presets/tcm/formula_composition.yaml@@ -0,0 +1,104 @@+language: [zh, en]++name: formula_composition+type: hypergraph+tags: [tcm, formula, prescription, composition]++description:+ zh: '方剂组成图模板 - 从经典方剂著作中提取方剂的组成和配伍关系'+ en: 'Formula Composition Graph Template - Extract formula composition and compatibility from classical formula texts'++output:+ description:+ zh: '方剂的组成和配伍关系'+ en: 'Formula composition and compatibility relationships'+ entities:+ description:+ zh: '方剂和药材'+ en: 'Formulas and herbs'+ fields:+ - name: name+ type: str+ description:+ zh: '方剂或药材名称'+ en: 'Formula or herb name'+ required: true+ - name: type+ type: str+ description:+ zh: '实体类型:方剂/药材'+ en: 'Entity type: formula/herb'+ required: true+ - name: description+ type: str+ description:+ zh: '说明'+ en: 'Description'+ required: false+ relations:+ description:+ zh: '方剂中药材的角色和配伍关系'+ en: 'Herb roles and compatibility in formulas'+ fields:+ - name: formula+ type: str+ description:+ zh: '方剂名称'+ en: 'Formula name'+ required: true+ - name: herb+ type: str+ description:+ zh: '药材名称'+ en: 'Herb name'+ required: true+ - name: role+ type: str+ description:+ zh: '药材角色:君/臣/佐/使'+ en: 'Herb role: sovereign/minister/assistant/envoy'+ required: true+ - name: dosage+ type: str+ description:+ zh: '剂量'+ en: 'Dosage'+ required: false+ - name: type+ type: str+ description:+ zh: '关系类型:contains/antagonizes'+ en: 'Relation type: contains/antagonizes'+ required: true++guideline:+ target:+ zh: '你是一位专业的中医药学家,负责从经典方剂著作中准确提取方剂的组成和配伍关系。'+ en: 'You are a professional traditional Chinese medicine scholar responsible for accurately extracting formula composition and compatibility from classical formula texts.'+ rules_for_entities:+ zh:+ - '提取方剂名称作为实体'+ - '提取方剂中的药材作为实体'+ - '角色分类应遵循中医方剂学理论'+ en:+ - 'Extract formula names as entities'+ - 'Extract herbs in formulas as entities'+ - 'Role classification should follow TCM formula theory'+ rules_for_relations:+ zh:+ - 'type为contains表示药材属于某方剂'+ - 'type为antagonizes表示相恶相反的配伍禁忌'+ - 'role字段应准确标注君臣佐使角色'+ en:+ - 'type contains indicates herb belongs to a formula'+ - 'type antagonizes indicates incompatible compatibility'+ - 'Role field should accurately indicate sovereign/minister/assistant/envoy role'++identifiers:+ entity_id: name+ relation_id: '{formula}|{type}|{herb}'+ relation_members: herb++display:+ entity_label: '{name}'+ relation_label: '{role}'diff --git a/hyperextract/templates/presets/tcm/herb_property.yaml b/hyperextract/templates/presets/tcm/herb_property.yamlnew file mode 100644index 0000000..0aa623a--- /dev/null+++ b/hyperextract/templates/presets/tcm/herb_property.yaml@@ -0,0 +1,74 @@+language: [zh, en]++name: herb_property+type: model+tags: [tcm, herb, traditional-chinese-medicine]++description:+ zh: '药材属性模型模板 - 从中药学教材中提取药材的基本属性信息'+ en: 'Herb Property Model Template - Extract basic property information of medicinal herbs from traditional Chinese medicine textbooks'++output:+ description:+ zh: '药材的基本属性'+ en: 'Basic properties of medicinal herbs'+ fields:+ - name: name+ type: str+ description:+ zh: '药材名称'+ en: 'Herb name'+ required: true+ - name: nature+ type: str+ description:+ zh: '四气:寒/热/温/凉/平'+ en: 'Four natures: cold/hot/warm/cool/neutral'+ required: true+ - name: flavor+ type: str+ description:+ zh: '五味:酸/苦/甘/辛/咸'+ en: 'Five flavors: sour/bitter/sweet/pungent/salty'+ required: true+ - name: meridian_entry+ type: str+ description:+ zh: '归经'+ en: 'Meridian entry'+ required: true+ - name: efficacy+ type: str+ description:+ zh: '主要功效'+ en: 'Main efficacy'+ required: true+ - name: toxicity+ type: str+ description:+ zh: '毒性(无毒/小毒/有毒)'+ en: 'Toxicity (non-toxic/slightly toxic/toxic)'+ required: false++guideline:+ target:+ zh: '你是一位专业的中医药学家,负责从中药学教材中准确提取药材的基本属性信息。'+ en: 'You are a professional traditional Chinese medicine scholar responsible for accurately extracting basic property information of medicinal herbs from TCM textbooks.'+ rules:+ zh:+ - '药材名称应使用规范的中药学名称'+ - '四气五味应按照中医药理论准确分类'+ - '归经应标注药物作用的经络'+ - '功效应概括主要治疗作用'+ - '毒性信息应准确标注'+ en:+ - 'Herb names should use standard TCM nomenclature'+ - 'Four natures and five flavors should be accurately classified according to TCM theory'+ - 'Meridian entry should indicate the meridians the drug acts on'+ - 'Efficacy should summarize the main therapeutic effects'+ - 'Toxicity information should be accurately labeled'++identifiers: {}++display:+ label: '{name}'diff --git a/hyperextract/templates/presets/tcm/herb_relation.yaml b/hyperextract/templates/presets/tcm/herb_relation.yamlnew file mode 100644index 0000000..fcfbc93--- /dev/null+++ b/hyperextract/templates/presets/tcm/herb_relation.yaml@@ -0,0 +1,94 @@+language: [zh, en]++name: herb_relation+type: graph+tags: [tcm, herb, compatibility, interaction]++description:+ zh: '药材关联图模板 - 从方剂学文献中提取药材之间的配伍关系'+ en: 'Herb Relation Graph Template - Extract herb compatibility relationships from formula literature'++output:+ description:+ zh: '药材之间的配伍关系网络'+ en: 'Herb compatibility relationship network'+ entities:+ description:+ zh: '药材实体'+ en: 'Herb entities'+ fields:+ - name: name+ type: str+ description:+ zh: '药材名称'+ en: 'Herb name'+ required: true+ - name: description+ type: str+ description:+ zh: '药材说明'+ en: 'Herb description'+ required: false+ relations:+ description:+ zh: '药材之间的配伍关系'+ en: 'Herb compatibility relationships'+ fields:+ - name: source+ type: str+ description:+ zh: '药材A'+ en: 'Herb A'+ required: true+ - name: target+ type: str+ description:+ zh: '药材B'+ en: 'Herb B'+ required: true+ - name: type+ type: str+ description:+ zh: '配伍类型:相须/相使/相畏/相杀/相恶/相反'+ en: 'Compatibility type: synergistic/mutual-enhancing/mutual-repressing/toxicity-reducing/antagonistic/incompatible'+ required: true+ - name: description+ type: str+ description:+ zh: '配伍说明'+ en: 'Compatibility description'+ required: false++guideline:+ target:+ zh: '你是一位专业的中医药学家,负责从方剂学文献中准确提取药材之间的配伍关系。'+ en: 'You are a professional traditional Chinese medicine scholar responsible for accurately extracting herb compatibility relationships from formula literature.'+ rules_for_entities:+ zh:+ - '提取药材名称作为实体'+ - '避免重复的药材实体'+ - '描述应简洁概括药材特性'+ en:+ - 'Extract herb names as entities'+ - 'Avoid duplicate herb entities'+ - 'Description should concisely summarize herb characteristics'+ rules_for_relations:+ zh:+ - '优先提取方剂学文献中明确描述的药材配伍关系'+ - '避免重复的配伍关系记录'+ - '仅提取文本中明确表达的配伍关系'+ en:+ - 'Prioritize explicitly described herb compatibility relationships from formula literature'+ - 'Avoid duplicate compatibility relationship records'+ - 'Only extract compatibility relationships explicitly expressed in the text'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/tcm/meridian_graph.yaml b/hyperextract/templates/presets/tcm/meridian_graph.yamlnew file mode 100644index 0000000..8c3d2e6--- /dev/null+++ b/hyperextract/templates/presets/tcm/meridian_graph.yaml@@ -0,0 +1,92 @@+language: [zh, en]++name: meridian_graph+type: graph+tags: [tcm, meridian, acupuncture, acupoint]++description:+ zh: '经络流注图模板 - 从针灸学教材中提取穴位和经脉的关系'+ en: 'Meridian Flow Graph Template - Extract relationships between acupoints and meridians from acupuncture textbooks'++output:+ description:+ zh: '穴位和经脉的关系网络'+ en: 'Network of acupoint and meridian relationships'+ entities:+ description:+ zh: '穴位和经脉'+ en: 'Acupoints and meridians'+ fields:+ - name: name+ type: str+ description:+ zh: '穴位或经脉名称'+ en: 'Acupoint or meridian name'+ required: true+ - name: type+ type: str+ description:+ zh: '实体类型:穴位/经脉'+ en: 'Entity type: acupoint/meridian'+ required: true+ - name: location+ type: str+ description:+ zh: '位置描述'+ en: 'Location description'+ required: false+ relations:+ description:+ zh: '穴位和经脉的归属和流注关系'+ en: 'Belonging and flow relationships between acupoints and meridians'+ fields:+ - name: source+ type: str+ description:+ zh: '源实体'+ en: 'Source entity'+ required: true+ - name: target+ type: str+ description:+ zh: '目标实体'+ en: 'Target entity'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:located_on/flows_to'+ en: 'Relation type: located_on/flows_to'+ required: true++guideline:+ target:+ zh: '你是一位专业的针灸学专家,负责从针灸学教材中准确提取穴位和经脉的关系。'+ en: 'You are a professional acupuncture expert responsible for accurately extracting relationships between acupoints and meridians from acupuncture textbooks.'+ rules_for_entities:+ zh:+ - '提取穴位名称作为实体'+ - '提取经脉名称作为实体'+ - '位置描述应准确标注解剖位置'+ en:+ - 'Extract acupoint names as entities'+ - 'Extract meridian names as entities'+ - 'Location descriptions should accurately indicate anatomical positions'+ rules_for_relations:+ zh:+ - 'type为located_on表示穴位属于某经脉'+ - 'type为flows_to表示经脉的流注顺序'+ en:+ - 'type located_on indicates acupoint belongs to a meridian'+ - 'type flows_to indicates the flow sequence of meridians'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/tcm/syndrome_reasoning.yaml b/hyperextract/templates/presets/tcm/syndrome_reasoning.yamlnew file mode 100644index 0000000..f6a23db--- /dev/null+++ b/hyperextract/templates/presets/tcm/syndrome_reasoning.yaml@@ -0,0 +1,106 @@+language: [zh, en]++name: syndrome_reasoning+type: hypergraph+tags: [tcm, syndrome, diagnosis, reasoning]++description:+ zh: '证候推理图模板 - 从医案和临床经验中提取症状、证候和治法的推理关系'+ en: 'Syndrome Reasoning Graph Template - Extract symptom-syndrome-treatment reasoning relationships from medical cases and clinical experience'++output:+ description:+ zh: '症状到证候到治法的推理链条'+ en: 'Reasoning chain from symptoms to syndrome to treatment'+ entities:+ description:+ zh: '症状、证候和治法要素'+ en: 'Symptom, syndrome, and treatment elements'+ fields:+ - name: name+ type: str+ description:+ zh: '要素名称'+ en: 'Element name'+ required: true+ - name: type+ type: str+ description:+ zh: '要素类型:症状/证候/治法/方剂'+ en: 'Element type: symptom/syndrome/treatment/formula'+ required: true+ - name: description+ type: str+ description:+ zh: '说明'+ en: 'Description'+ required: false+ relations:+ description:+ zh: '症状、证候、治法之间的推理关系'+ en: 'Reasoning relationships between symptoms, syndromes, and treatments'+ fields:+ - name: symptom+ type: list+ description:+ zh: '症状表现'+ en: 'Symptom manifestations'+ required: false+ - name: syndrome+ type: str+ description:+ zh: '证候类型'+ en: 'Syndrome type'+ required: true+ - name: principle+ type: str+ description:+ zh: '治法原则'+ en: 'Treatment principle'+ required: true+ - name: formula+ type: str+ description:+ zh: '推荐方剂'+ en: 'Recommended formula'+ required: false+ - name: type+ type: str+ description:+ zh: '关系类型:leads_to/treated_by'+ en: 'Relation type: leads_to/treated_by'+ required: true++guideline:+ target:+ zh: '你是一位专业的中医临床专家,负责从医案和临床经验中准确提取证候推理关系。'+ en: 'You are a professional TCM clinical expert responsible for accurately extracting syndrome reasoning relationships from medical cases and clinical experience.'+ rules_for_entities:+ zh:+ - '提取症状表现作为实体'+ - '提取证候类型作为实体'+ - '提取治法原则作为实体'+ - '提取推荐方剂作为实体'+ en:+ - 'Extract symptom manifestations as entities'+ - 'Extract syndrome types as entities'+ - 'Extract treatment principles as entities'+ - 'Extract recommended formulas as entities'+ rules_for_relations:+ zh:+ - 'type为leads_to表示从症状到证候的推导'+ - 'type为treated_by表示从证候到治法的对应'+ - 'symptom字段应包含所有相关的症状'+ en:+ - 'type leads_to indicates derivation from symptoms to syndrome'+ - 'type treated_by indicates correspondence from syndrome to treatment'+ - 'Symptom field should include all related symptoms'++identifiers:+ entity_id: name+ relation_id: '{syndrome}|{type}|{principle}'+ relation_members: symptom++display:+ entity_label: '{name}'+ relation_label: '{type}'