Files
PlantAI-rag/docs/guides/EXTRACTOR_CATALOG.md
2026-07-10 17:59:59 +08:00

392 lines
14 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 提取器分类目录 - gene-family-mas-v2
## 📁 目录结构
```
gene-family-mas-v2/
├── extractors/ # 主提取器(根目录)
│ ├── fusion/ # PC融合版
│ ├── llm/ # LLM提取器
│ └── legacy/ # 旧版提取器
├── src/rag/extractors/ # RAG集成提取器
│ ├── core/ # 核心提取器(v11-v12)
│ ├── supplementary/ # 附表相关
│ ├── section/ # 章节处理
│ └── smart/ # 智能提取器
├── scripts/extractors/ # 脚本提取器
│ ├── v7-v9/ # 早期版本
│ ├── v10/ # v10系列
│ └── phylogeny/ # 系统发育专用
├── scripts/utils/ # 工具脚本
└── tests/ # 测试脚本
```
---
## 🎯 一、主提取器(根目录)
### 1.1 PC融合版(推荐用于对标PC)
| 文件名 | 版本 | 功能描述 | 状态 |
|--------|------|----------|------|
| `extractor_fusion_complete.py` | v1.0 | **当前主用**,8种实体,7种关系,复合展开 | ✅ 推荐 |
| `extractor_fusion_v1.py` | v1.0 | 融合版初版 | ⚠️ 旧版 |
| `extractor_pc_based.py` | v1.0 | 基于PC规则库(788模式) | ⚠️ 性能慢 |
| `extractor_pc_complete.py` | - | PC完整版 | ❌ 未完成 |
| `extractor_pc_style.py` | - | PC风格版 | ⚠️ 测试版 |
| `extractor_pc_*.py` | - | 其他PC变体(122_types, entities, entities_v2, full_types, v2) | ⚠️ 实验版 |
**核心功能**:
- 8种实体:gene, tissue, metabolite, process, compartment, chromosome, species, phylogeny_group
- 7种关系:expressed_in, transports, located_on, grouped_with, involved_in, localizes_to, identified_in
- 复合基因展开、证据验证
### 1.2 LLM提取器
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `llm_extractor_dashscope.py` | 百炼API提取 | ✅ 可用 |
| `llm_extractor_simple.py` | 简单LLM提取 | ⚠️ 基础版 |
| `llm_extractor_v2.py` | LLM提取v2 | ⚠️ 旧版 |
| `llm_relation_extractor.py` | LLM关系提取 | ⚠️ 专用 |
### 1.3 混合/增强版
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extractor_hybrid.py` | 混合提取 | ⚠️ 实验 |
| `extractor_hybrid_v3.py` | 混合v3 | ⚠️ 实验 |
| `extractor_enhanced.py` | 增强版 | ⚠️ 旧版 |
| `extractor_final.py` | 最终版 | ⚠️ 旧版 |
| `extractor_complete_v1.py` | 完整版v1 | ⚠️ 旧版 |
| `extractor_production_v1.py` | 生产版 | ⚠️ 旧版 |
### 1.4 SUC5专用(早期实验)
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extractor_suc5.py` | SUC5提取 | ❌ 归档 |
| `extractor_suc5_v2.py` | SUC5 v2 | ❌ 归档 |
| `extractor_suc5_v3.py` | SUC5 v3 | ❌ 归档 |
| `extractor_suc5_v4.py` | SUC5 v4 | ❌ 归档 |
| `extractor_suc5_final.py` | SUC5最终 | ❌ 归档 |
| `extractor_suc5_pc_match.py` | SUC5 PC匹配 | ❌ 归档 |
### 1.5 其他专用
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extractor_v2_pro.py` | v2专业版 | ❌ 归档 |
| `extract_complete_sentence.py` | 完整句子提取 | ⚠️ 工具 |
| `universal_extractor_v1.py` | 通用提取v1 | ⚠️ 旧版 |
| `universal_extractor_v2.py` | 通用提取v2 | ⚠️ 旧版 |
---
## 🎯 二、RAG集成提取器(src/rag/extractors/)
### 2.1 核心提取器(v11-v12)
| 文件名 | 版本 | 功能 | 状态 |
|--------|------|------|------|
| `extract_v12_final.py` | v12 | **完整版**,附表下载+章节补充+实体过滤 | ✅ 推荐 |
| `extract_v12_1_fixed.py` | v12.1 | 修复版,保存章节文本 | ✅ 可用 |
| `extract_v12_1_complete.py` | v12.1 | 完整版 | ⚠️ 待验证 |
| `extract_v12_1_improved.py` | v12.1 | 改进版 | ⚠️ 待验证 |
| `extract_v12_1_curl.py` | v12.1 | curl版本 | ⚠️ 工具 |
| `extract_v11_final.py` | v11 | v11最终版 | ⚠️ 旧版 |
**v12核心功能**:
- 附表自动下载(Europe PMC)
- marker-pdf章节识别
- PyMuPDF章节补充
- 实体过滤(gene_entity_filter)
- gene-centric chunks
- **缺点**:关系抽取不完整
### 2.2 附表相关
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `supplementary_downloader.py` | **附表下载器**(Europe PMC) | ✅ 核心工具 |
| `data_availability_extractor.py` | 数据可用性提取 | ⚠️ 专用 |
| `multi_db_extractor.py` | 多数据库提取 | ⚠️ 专用 |
| `geo_extractor.py` | **GEO数据提取** | ✅ 重要 |
### 2.3 章节处理
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `section_trigger.py` | 章节补充触发器 | ✅ 工具 |
| `section_supplementer.py` | 章节补充器 | ✅ 工具 |
| `marker_section_chunker.py` | marker章节切分 | ⚠️ 工具 |
| `hybrid_section_chunker.py` | 混合章节切分 | ⚠️ 工具 |
### 2.4 实体处理
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `gene_entity_filter.py` | **基因实体过滤器** | ✅ 核心工具 |
| `gene_centric_chunker.py` | **gene-centric chunks生成** | ✅ 核心工具 |
| `complete_gene_extractor.py` | 完整基因提取 | ⚠️ 专用 |
| `universal_gene_family_extractor.py` | 通用基因家族提取 | ⚠️ 专用 |
| `smart_gene_family_extractor.py` | 智能提取器 | ⚠️ 专用 |
| `smart_gene_family_extractor_v2.py` | 智能提取器v2 | ⚠️ 专用 |
### 2.5 PDF处理
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `enhanced_pdf_extractor.py` | 增强PDF提取 | ⚠️ 旧版 |
| `enhanced_pdf_extractor_v2.py` | 增强PDF提取v2 | ⚠️ 旧版 |
| `unified_data_extractor.py` | 统一数据提取 | ⚠️ 整合 |
| `expression_relation_extractor.py` | 表达关系提取 | ⚠️ 专用 |
| `compare_extractors.py` | 提取器对比 | ⚠️ 工具 |
---
## 🎯 三、脚本提取器(scripts/extractors/)
### 3.1 v10系列(附表支持)
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extract_v10_with_supplementary.py` | **v10附表增强版** | ✅ 推荐 |
| `extract_v10_final.py` | v10最终版 | ⚠️ 旧版 |
| `extract_v10_final_v2.py` | v10最终版v2 | ⚠️ 旧版 |
| `extract_v10_revised.py` | v10修订版 | ⚠️ 旧版 |
| `extract_v10_integrated.py` | v10集成版 | ⚠️ 旧版 |
| `extract_v10_chromosome_complete.py` | v10染色体完整版 | ⚠️ 专用 |
### 3.2 v7-v9系列(早期版本)
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extract_v9_complete.py` | v9完整版 | ❌ 归档 |
| `extract_v8_rag.py` | v8 RAG版 | ❌ 归档 |
| `extract_v7_complete.py` | v7完整版 | ❌ 归档 |
| `extract_v7_final.py` | v7最终版 | ❌ 归档 |
| `extract_v7_full_simple.py` | v7简单版 | ❌ 归档 |
| `extract_v7_with_supp.py` | v7附表版 | ❌ 归档 |
### 3.3 系统发育专用(phylogeny)
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extract_phylogeny_v7_revised.py` | v7修订版 | ❌ 归档 |
| `extract_phylogeny_v7_full.py` | v7完整版 | ❌ 归档 |
| `extract_phylogeny_v7.py` | v7 | ❌ 归档 |
| `extract_phylogeny_v6_2_universal.py` | v6.2通用版 | ❌ 归档 |
| `extract_phylogeny_v6_full.py` | v6完整版 | ❌ 归档 |
| `extract_phylogeny_v6.py` | v6 | ❌ 归档 |
| `extract_phylogeny_v5_universal_v3.py` | v5.3通用版 | ❌ 归档 |
### 3.4 知识图谱导入
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `kg_import.py` | KG导入 | ⚠️ 工具 |
| `kg_schema.py` | KG schema | ⚠️ 工具 |
| `import_genes_to_kg.py` | 导入基因到KG | ⚠️ 工具 |
| `import_groups_to_kg.py` | 导入分组到KG | ⚠️ 工具 |
| `import_tair_families.py` | 导入TAIR家族 | ⚠️ 工具 |
| `save_results.py` | 保存结果 | ⚠️ 工具 |
| `v7_reviewer.py` | v7审查 | ⚠️ 工具 |
| `batch_extract.py` | 批量提取 | ⚠️ 工具 |
---
## 🎯 四、工具脚本(scripts/utils/)
### 4.1 附表/数据获取
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `fetch_supplementary_data.py` | 获取附表数据 | ✅ 工具 |
| `universal_supplementary_fetcher.py` | 通用附表获取 | ✅ 工具 |
### 4.2 数据处理
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `add_missing_genes.py` | 添加缺失基因 | ⚠️ 工具 |
| `apply_locus_mapping.py` | 应用位点映射 | ⚠️ 工具 |
| `chunk_by_section.py` | 按章节切分 | ⚠️ 工具 |
| `expand_expression_relations.py` | 扩展表达关系 | ⚠️ 工具 |
| `expand_selective.py` | 选择性扩展 | ⚠️ 工具 |
| `merge_all_extractions.py` | 合并所有提取 | ⚠️ 工具 |
| `final_merge_and_eval.py` | 最终合并评估 | ⚠️ 工具 |
| `final_merge_v2.py` | 最终合并v2 | ⚠️ 工具 |
| `final_merge_v3.py` | 最终合并v3 | ⚠️ 工具 |
| `post_process_aggressive.py` | 激进后处理 | ⚠️ 工具 |
| `post_process_filter.py` | 后处理过滤 | ⚠️ 工具 |
### 4.3 验证/评估
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `validate_extraction.py` | 验证提取 | ⚠️ 工具 |
| `generate_validation_report.py` | 生成验证报告 | ⚠️ 工具 |
| `reasoning_engine.py` | 推理引擎 | ⚠️ 工具 |
### 4.4 数据库
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `kg_sqlite.py` | SQLite KG操作 | ⚠️ 工具 |
---
## 🎯 五、其他重要脚本(scripts/)
### 5.1 RAG构建
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `build_rag_index.py` | 构建RAG索引 | ✅ 重要 |
| `build_rag_v2.py` | 构建RAG v2 | ⚠️ 旧版 |
| `build_multi_layer_rag.py` | 构建多层RAG | ⚠️ 专用 |
| `create_faiss_index.py` | 创建FAISS索引 | ✅ 重要 |
| `create_faiss_index_bge.py` | BGE版FAISS | ✅ 重要 |
| `create_faiss_index_enhanced.py` | 增强版FAISS | ⚠️ 旧版 |
| `create_faiss_index_ollama.py` | Ollama版FAISS | ⚠️ 专用 |
### 5.2 Qdrant迁移
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `migrate_to_qdrant.py` | 迁移到Qdrant | ✅ 重要 |
| `migrate_to_qdrant_fast.py` | 快速迁移 | ⚠️ 旧版 |
| `migrate_to_qdrant_quick.py` | 快速迁移v2 | ⚠️ 旧版 |
| `migrate_to_qdrant_sync.py` | 同步迁移 | ⚠️ 旧版 |
| `migrate_all_to_qdrant.py` | 全部迁移 | ⚠️ 旧版 |
### 5.3 测试脚本
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `test_smart_extractor_lizhi.py` | 测试荔枝提取 | ⚠️ 测试 |
| `test_lizhi_extraction.py` | 荔枝提取测试 | ⚠️ 测试 |
| `test_expression_extraction.py` | 表达提取测试 | ⚠️ 测试 |
| `test_v2_simple.py` | v2简单测试 | ⚠️ 测试 |
| `test_v2_with_sample.py` | v2样本测试 | ⚠️ 测试 |
| `test_v6_2_comparison.py` | v6.2对比测试 | ⚠️ 测试 |
| `test_phase2_complete.py` | Phase2完整测试 | ⚠️ 测试 |
| `test_prompt_v2.py` | Prompt v2测试 | ⚠️ 测试 |
| `test_api.py` | API测试 | ⚠️ 测试 |
| `test_rag.py` | RAG测试 | ⚠️ 测试 |
| `test_qdrant*.py` | Qdrant系列测试 | ⚠️ 测试 |
| `test_hybrid_qdrant.py` | 混合Qdrant测试 | ⚠️ 测试 |
| `test_agentic_pipeline.py` | Agent管道测试 | ⚠️ 测试 |
| `simple_test_v2.py` | v2简单测试 | ⚠️ 测试 |
| `end_to_end_test.py` | 端到端测试 | ⚠️ 测试 |
### 5.4 v2系列(早期RAG)
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extract_v2_1.py` | v2.1提取 | ❌ 归档 |
| `extract_v2_2_two_stage.py` | v2.2两阶段 | ❌ 归档 |
| `extract_v2_direct.py` | v2直接版 | ❌ 归档 |
| `extract_v2_robust.py` | v2鲁棒版 | ❌ 归档 |
| `run_v2_extraction.py` | 运行v2提取 | ❌ 归档 |
| `run_v2_extraction_simple.py` | v2简单运行 | ❌ 归档 |
| `run_v2_extraction_standalone.py` | v2独立运行 | ❌ 归档 |
| `run_v2_full.py` | v2完整运行 | ❌ 归档 |
| `run_v2_interactive.py` | v2交互运行 | ❌ 归档 |
### 5.5 结构化数据提取
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `extract_structured_data.py` | 结构化数据提取 | ⚠️ 专用 |
| `extract_structured_data_llm.py` | LLM结构化提取 | ⚠️ 专用 |
| `extract_structured.py` | 结构化提取 | ⚠️ 专用 |
---
## 🎯 六、测试目录(tests/)
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `structured_extractor.py` | 结构化提取器测试 | ⚠️ 测试 |
---
## 🎯 七、其他根目录脚本
| 文件名 | 功能 | 状态 |
|--------|------|------|
| `test_llm_extraction.py` | LLM提取测试 | ⚠️ 测试 |
| `test_sentence_extraction.py` | 句子提取测试 | ⚠️ 测试 |
---
## 📊 使用建议
### 场景1:对标PC项目
**推荐**:`extractor_fusion_complete.py`
- 8种实体类型对齐PC
- 7种关系类型
- 788个PC规则模式
### 场景2:完整提取(含附表)
**推荐**:`src/rag/extractors/extract_v12_final.py`
- 自动下载附表
- marker-pdf章节识别
- gene-centric chunks
### 场景3:GEO数据提取
**推荐**:`src/rag/extractors/geo_extractor.py`
- NCBI GEO数据获取
- 表达数据下载
### 场景4:附表下载
**推荐**:`src/rag/extractors/supplementary_downloader.py`
- Europe PMC附表下载
- 多期刊支持
---
## 🗂️ 整理建议
### 立即保留(根目录)
```
extractor_fusion_complete.py # 当前主用
extractor_fusion_v1.py # 备份
extractor_pc_based.py # PC规则版
llm_extractor_dashscope.py # LLM提取
llm_relation_extractor.py # LLM关系
universal_extractor_v2.py # 通用版
```
### 归档到 archive/old_extractors/
```
extractor_suc5*.py # SUC5专用
extractor_v2_pro.py # v2旧版
extractor_hybrid*.py # 混合实验版
extractor_enhanced.py # 增强旧版
extractor_final.py # 最终旧版
extractor_complete_v1.py # 完整旧版
extractor_production_v1.py # 生产旧版
extract_complete_sentence.py # 句子提取
universal_extractor_v1.py # 通用v1
```
### 归档PC实验版
```
extractor_pc_122_types.py
extractor_pc_complete.py
extractor_pc_complete_types.py
extractor_pc_entities.py
extractor_pc_entities_v2.py
extractor_pc_full_types.py
extractor_pc_style.py
extractor_pc_v2.py
```
---
*最后更新:2026-04-12*
*维护者:xialab的幸运星*