Initial: integrated 2025 LawGraph (graphrag_pipeline) + 2026 kg_project
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
llm:
|
||||
model: "deepseek-chat"
|
||||
temperature: 0.0
|
||||
max_tokens: 8192
|
||||
max_retries: 3
|
||||
retry_delay: 2
|
||||
request_timeout: 120
|
||||
batch_timeout: 600
|
||||
|
||||
batch_processing:
|
||||
batch_size: 10
|
||||
concurrent_requests: 5
|
||||
test_batch_size: 5
|
||||
incremental_save: true
|
||||
|
||||
deduplication:
|
||||
similarity_threshold: 0.85
|
||||
enable_fuzzy_matching: true
|
||||
text_normalization: true
|
||||
|
||||
validation:
|
||||
enable_entity_validation: true
|
||||
enable_relationship_validation: true
|
||||
min_confidence_score: 0.7
|
||||
strict_mode: false
|
||||
filter_generic_concepts: true
|
||||
|
||||
output:
|
||||
nodes_file: "output/nodes_llm_v2.csv"
|
||||
relationships_file: "output/rels_llm_v2.csv"
|
||||
report_file: "output/extraction_report_v2.md"
|
||||
encoding: "utf-8-sig"
|
||||
|
||||
progress:
|
||||
progress_file: "output/progress_v2.json"
|
||||
checkpoint_interval: 10
|
||||
|
||||
logging:
|
||||
log_file: "logs/deep_extraction_v2.log"
|
||||
level: "INFO"
|
||||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
|
||||
# ============================================================
|
||||
# 第二轮本体:城市更新法规政策工具箱 (21实体 + 34关系)
|
||||
# ============================================================
|
||||
|
||||
entity_type_prompts:
|
||||
Agency: "主体机构:发布主体、实施主体、监管主体、责任主体,包括政府部门(全国人大常委会、国务院、自然资源部、住建部、生态环境部、发改委、地方政府)、实施机构、平台公司、社区组织、第三方机构等。属性:level(国家/省级/市级/县级/乡镇街道/社区)、agency_type(立法机关/行政机关/主管部门/实施主体/监管主体/责任主体/市场主体/社区组织/第三方机构)"
|
||||
LegalObject: "法规事项:法规政策所规制的事项,回答'管什么事项'。如规划编制、土地利用、建设管理、历史文化保护、生态保护、财政支持、金融支持、产权登记、公众参与、行政审批、监督管理、城市更新、公共服务、基础设施、安全韧性等。属性:category"
|
||||
SpatialObject: "空间对象:城市更新中的具体空间对象,回答'作用于什么空间'。如老旧小区、城中村、低效用地、工业遗存、历史文化街区、历史建筑、公共空间、公共服务设施、市政基础设施、存量建筑、建设用地、城市更新单元、生态保护红线、永久基本农田、城镇开发边界等。属性:spatial_type"
|
||||
RenewalScene: "更新场景:城市更新应用场景,回答'用于什么更新场景'。如老旧小区改造、城中村改造、低效用地再开发、工业遗存更新、历史文化保护更新、完整社区建设、公共空间提升、基础设施补短板、城市安全韧性提升、城市生态修复等。属性:scene_type、derivation_method(原文提取/语义归纳/人工标注/模型推理)"
|
||||
PolicyTool: "具体政策工具:城市更新中用于实现治理目标的具体政策、制度、措施或治理手段。属性:tool_type(命令型/激励型/劝诫型/能力型/系统变革型)、mandatory_level(强制/引导/鼓励/支持/禁止/限制)、source_text"
|
||||
ToolCategory: "政策工具类别:归类政策工具的分类节点。属性:classification_system(一般政策工具分类/城市更新工具分类)、urban_renewal_category(规划引导/土地配置/开发激励/财政金融/权益协调/实施管理/监督反馈)"
|
||||
Procedure: "程序:审批、备案、评估、论证、公示、听证、入库、验收、监督、征收、补偿等行政或治理程序。属性:procedure_type、time_limit"
|
||||
Obligation: "权利义务:法规规定的权利、义务、禁止或责任。属性:obligation_type(权利/义务/禁止/职责/鼓励/支持)、modality(应当/可以/不得/禁止/鼓励/支持/负责/依法)"
|
||||
Condition: "适用条件:政策工具或程序适用时的前置条件。如'经批准后''符合XX条件'。属性:condition_type(规划条件/审批条件/权属条件/安全条件/环保条件/公众参与条件/程序条件/资金条件)"
|
||||
Constraint: "约束条件:对行为设置的边界性、底线性或限制性要求。如'不得突破''严守''控制线'。属性:constraint_type(用途管制/空间边界/强制标准/历史保护/生态保护/权益保护/安全底线/公共利益)"
|
||||
Penalty: "法律责任:违反法规后的处罚。属性:penalty_type(行政处罚/刑事处罚/民事责任/行政处分/信用惩戒/整改责任)、amount_or_measure"
|
||||
TimePoint: "时间节点:生效、修订、废止、截止、过渡期等时间信息。属性:time_type(发布日期/生效日期/修订日期/废止日期/截止日期/过渡期)"
|
||||
Region: "适用区域:全国、省、市、县、特定区域等。属性:level(全国/区域/省/市/县/乡镇街道/社区/特定区域)"
|
||||
|
||||
relationship_type_prompts:
|
||||
# 文档层次
|
||||
has_chapter: "文档包含章"
|
||||
has_section: "章包含节"
|
||||
has_article: "文件/章/节包含条文"
|
||||
has_clause: "条文包含款"
|
||||
article_in_document: "条文或款属于某一法规文件"
|
||||
# 法条依据
|
||||
cites: "引用其他法规:如'根据《城乡规划法》第X条'、'依据《土地管理法》规定'、'按照国务院有关规定'"
|
||||
implements: "实施上位法:如'为实施《城乡规划法》制定本办法'、'根据《土地管理法》授权'"
|
||||
amends: "修正/修订:如'对《XX法》作如下修改'、'将第X条修改为'"
|
||||
replaces: "替代/废止:如'本法自施行之日起,XX法同时废止'"
|
||||
supplements: "补充规定:如'在XX基础上补充规定'"
|
||||
basis_for_planning: "法规或条文作为规划编制、审批、实施或政策工具设立的依据"
|
||||
# 主体关系
|
||||
issued_by: "法规文件由某主体发布或制定"
|
||||
implemented_by: "条文、政策工具、程序或义务由某主体负责实施"
|
||||
assigned_to: "监管职责、管理职责、实施任务分配给某主体"
|
||||
# 语义规制
|
||||
regulates: "条文对某法规事项进行规制(准入、禁止、限制、鼓励、保护等)"
|
||||
defines_object: "条文对法规事项、空间对象或更新场景进行定义或界定"
|
||||
applies_to: "条文、程序或政策工具适用于某法规事项、空间对象、更新场景或区域"
|
||||
sets_obligation: "条文设定权利、义务、禁止、职责或支持性要求"
|
||||
sets_condition: "条文、政策工具或程序设置适用条件(前置条件)"
|
||||
sets_constraint: "条文、政策工具或程序设置边界性、底线性或限制性要求"
|
||||
prescribes_penalty: "条文规定了违法行为的法律后果"
|
||||
# 政策工具
|
||||
extracts_tool: "从条文中识别出具体政策工具"
|
||||
belongs_to_category: "具体政策工具属于某类政策工具类别"
|
||||
applies_to_scene: "政策工具适用于某类城市更新场景"
|
||||
targets_object: "政策工具作用于某一法规事项或空间对象"
|
||||
coordinates_with: "两个政策工具之间存在并列协同或组合使用关系"
|
||||
supports_tool: "一个政策工具对另一个形成前置支撑或条件支撑"
|
||||
# 程序
|
||||
requires_procedure: "条文、政策工具或法规事项要求履行某类程序"
|
||||
procedure_for: "某一程序对应某类法规事项、空间对象、更新场景或政策工具"
|
||||
precedes_procedure: "一个程序在时序上先于另一个程序"
|
||||
# 辅助
|
||||
governs_region: "法规政策或条文适用于某一区域"
|
||||
effective_timeline: "法规文件关联时间节点(发布/生效/修订/废止)"
|
||||
standard_for: "标准、规范或条文适用于某一法规事项、空间对象、程序或政策工具"
|
||||
article_effective_timeline: "条文关联时间节点(生效/截止/过渡期)"
|
||||
|
||||
extraction_tips:
|
||||
citation_patterns: "注意识别法条引用模式:'根据《XX法》'、'依照第X条规定'、'按照国务院XX规定'、'参照XX标准执行'"
|
||||
article_classification: "法条类型判断:管理性(应当/必须)、禁止性(不得/禁止)、授权性(可以/有权)、程序性(申请/审批/备案)、处罚性(罚款/责令/没收)"
|
||||
cross_reference: "特别注意跨文档引用:当条文引用其他法规时,创建cites关系并记录引用上下文"
|
||||
entity_boundary_rules: |
|
||||
实体边界规则(严格遵守):
|
||||
- LegalObject:法规事项,回答"管什么事项",如规划编制、土地利用、财政支持
|
||||
- SpatialObject:空间对象,回答"作用于什么空间",如老旧小区、城中村、低效用地
|
||||
- RenewalScene:更新场景,回答"用于什么更新场景",如老旧小区改造、城中村改造
|
||||
- Procedure:程序,强调流程步骤(审批/备案/评估/公示/验收/入库)
|
||||
- PolicyTool:政策工具,强调治理手段、政策措施、制度安排或支持机制
|
||||
- Obligation:权利义务,强调主体应当/可以/不得做什么
|
||||
- Condition:适用条件,强调前置条件(经批准/符合/满足/具备)
|
||||
- Constraint:约束条件,强调底线限制(不得突破/严守/控制线/强制性标准)
|
||||
do_not_extract: |
|
||||
- 不要新增本体之外的实体类型或关系类型
|
||||
- 文本中没有依据时不要强行抽取
|
||||
- conflicts_with和has_gap不纳入本阶段抽取
|
||||
@@ -0,0 +1,86 @@
|
||||
project_name: "urban_planning_law_kg"
|
||||
project_description: "城市规划法律法规知识图谱构建"
|
||||
|
||||
data:
|
||||
source_dir: "E:\\Project\\SI\\2026_KG_PlanningLaw\\data\\城市规划法律法规\\城市更新法规数据库"
|
||||
total_documents: 296
|
||||
categories:
|
||||
- {id: 0, name: "0知识图谱目录", type: "Index"}
|
||||
- {id: 1, name: "1法律", type: "Law"}
|
||||
- {id: 2, name: "2行政法规", type: "AdministrativeRegulation"}
|
||||
- {id: 3, name: "3部门规章", type: "DepartmentalRule"}
|
||||
- {id: 4, name: "4党中央国务院文件", type: "PolicyDocument"}
|
||||
- {id: 5, name: "5国家主管部门文件", type: "PolicyDocument"}
|
||||
- {id: 6, name: "6主要技术标准", type: "PolicyDocument"}
|
||||
min_text_length: 50
|
||||
|
||||
api:
|
||||
config_file: "config/api_keys.yaml"
|
||||
model: "deepseek-chat"
|
||||
max_tokens: 8192
|
||||
temperature: 0.0
|
||||
|
||||
processing:
|
||||
concurrent_requests: 5
|
||||
max_retries: 3
|
||||
retry_delay: 2
|
||||
batch_size: 10
|
||||
|
||||
paths:
|
||||
config_dir: "config"
|
||||
data_dir: "data"
|
||||
output_dir: "output"
|
||||
logs_dir: "logs"
|
||||
ontology_dir: "ontology"
|
||||
scripts_dir: "scripts"
|
||||
src_dir: "src"
|
||||
|
||||
ontology:
|
||||
ontology_file: "ontology/legal_ontology.json"
|
||||
entity_ontology_file: "config/legal_ontology.yaml"
|
||||
|
||||
neo4j:
|
||||
uri: "bolt://localhost:7687"
|
||||
username: "neo4j"
|
||||
password: "password"
|
||||
database: "neo4j"
|
||||
|
||||
extraction:
|
||||
entity_types:
|
||||
- Law
|
||||
- AdministrativeRegulation
|
||||
- DepartmentalRule
|
||||
- PolicyDocument
|
||||
- Chapter
|
||||
- Section
|
||||
- Article
|
||||
- GovernmentBody
|
||||
- LegalSubject
|
||||
- SpatialConcept
|
||||
- AdministrativeProcedure
|
||||
- Obligation
|
||||
- Penalty
|
||||
- TimePoint
|
||||
- Region
|
||||
relation_types:
|
||||
- cites
|
||||
- implements
|
||||
- amends
|
||||
- replaces
|
||||
- supplements
|
||||
- issued_by
|
||||
- implemented_by
|
||||
- regulates
|
||||
- defines_spatial
|
||||
- requires_procedure
|
||||
- sets_obligation
|
||||
- prescribes_penalty
|
||||
- applies_to
|
||||
- governs_region
|
||||
confidence_threshold:
|
||||
entity: 0.8
|
||||
relation: 0.7
|
||||
|
||||
logging:
|
||||
level: "INFO"
|
||||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
@@ -0,0 +1,246 @@
|
||||
entity_types:
|
||||
Law:
|
||||
prefix: "LAW"
|
||||
description: "全国人大及其常委会制定的法律"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- full_title
|
||||
- promulgation_date
|
||||
- effective_date
|
||||
- status
|
||||
- amendment_dates
|
||||
|
||||
AdministrativeRegulation:
|
||||
prefix: "REG"
|
||||
description: "国务院制定的行政法规"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- full_title
|
||||
- promulgation_date
|
||||
- effective_date
|
||||
- status
|
||||
- order_number
|
||||
|
||||
DepartmentalRule:
|
||||
prefix: "RULE"
|
||||
description: "各部委制定的部门规章"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- full_title
|
||||
- promulgation_date
|
||||
- effective_date
|
||||
- status
|
||||
- order_number
|
||||
|
||||
PolicyDocument:
|
||||
prefix: "DOC"
|
||||
description: "党中央/国务院/主管部门文件、技术标准"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- full_title
|
||||
- issue_date
|
||||
- document_number
|
||||
- document_type
|
||||
- status
|
||||
|
||||
Chapter:
|
||||
prefix: "CH"
|
||||
description: "法律文件的章"
|
||||
required_attributes: [name, number]
|
||||
optional_attributes:
|
||||
- title
|
||||
|
||||
Section:
|
||||
prefix: "SEC"
|
||||
description: "法律文件的节"
|
||||
required_attributes: [name, number]
|
||||
optional_attributes:
|
||||
- title
|
||||
|
||||
Article:
|
||||
prefix: "ART"
|
||||
description: "法律文件的具体条文"
|
||||
required_attributes: [number, text]
|
||||
optional_attributes:
|
||||
- article_type
|
||||
|
||||
GovernmentBody:
|
||||
prefix: "GOV"
|
||||
description: "立法/行政/主管部门"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- full_name
|
||||
- level
|
||||
- type
|
||||
|
||||
LegalSubject:
|
||||
prefix: "SUBJ"
|
||||
description: "法律规制的事项或主体"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- category
|
||||
- description
|
||||
|
||||
SpatialConcept:
|
||||
prefix: "SPAT"
|
||||
description: "国土空间规划中的空间概念"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- type
|
||||
- definition
|
||||
|
||||
AdministrativeProcedure:
|
||||
prefix: "PROC"
|
||||
description: "规划/用地/建设的行政程序"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- type
|
||||
- time_limit
|
||||
- applicable_subjects
|
||||
|
||||
Obligation:
|
||||
prefix: "OBL"
|
||||
description: "法律条文规定的权利、义务或禁止"
|
||||
required_attributes: [text]
|
||||
optional_attributes:
|
||||
- type
|
||||
|
||||
Penalty:
|
||||
prefix: "PEN"
|
||||
description: "违反法律规定的处罚"
|
||||
required_attributes: [type, description]
|
||||
optional_attributes:
|
||||
- applicable_violation
|
||||
- legal_basis
|
||||
|
||||
TimePoint:
|
||||
prefix: "TIME"
|
||||
description: "法规中提到的具体时间"
|
||||
required_attributes: [description]
|
||||
optional_attributes:
|
||||
- year
|
||||
- time_type
|
||||
|
||||
Region:
|
||||
prefix: "REGION"
|
||||
description: "法规适用的区域"
|
||||
required_attributes: [name]
|
||||
optional_attributes:
|
||||
- level
|
||||
- feature
|
||||
|
||||
relationship_types:
|
||||
has_chapter:
|
||||
description: "包含章"
|
||||
source_types: ["Law", "AdministrativeRegulation", "DepartmentalRule", "PolicyDocument"]
|
||||
target_types: ["Chapter"]
|
||||
|
||||
has_section:
|
||||
description: "包含节"
|
||||
source_types: ["Chapter"]
|
||||
target_types: ["Section"]
|
||||
|
||||
contains_article:
|
||||
description: "包含条"
|
||||
source_types: ["Chapter", "Section"]
|
||||
target_types: ["Article"]
|
||||
|
||||
article_in_document:
|
||||
description: "条属于文件"
|
||||
source_types: ["Article"]
|
||||
target_types: ["Law", "AdministrativeRegulation", "DepartmentalRule", "PolicyDocument"]
|
||||
|
||||
cites:
|
||||
description: "引用其他法规"
|
||||
source_types: ["Article", "PolicyDocument"]
|
||||
target_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
|
||||
implements:
|
||||
description: "实施/落实上位法"
|
||||
source_types: ["PolicyDocument", "DepartmentalRule"]
|
||||
target_types: ["Law", "AdministrativeRegulation"]
|
||||
|
||||
amends:
|
||||
description: "修正/修订"
|
||||
source_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
target_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
|
||||
replaces:
|
||||
description: "替代/废止"
|
||||
source_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
target_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
|
||||
supplements:
|
||||
description: "补充"
|
||||
source_types: ["PolicyDocument"]
|
||||
target_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
|
||||
issued_by:
|
||||
description: "发布机关"
|
||||
source_types: ["Law", "AdministrativeRegulation", "DepartmentalRule", "PolicyDocument"]
|
||||
target_types: ["GovernmentBody"]
|
||||
|
||||
implemented_by:
|
||||
description: "实施机关"
|
||||
source_types: ["Article", "AdministrativeProcedure"]
|
||||
target_types: ["GovernmentBody"]
|
||||
|
||||
regulates:
|
||||
description: "规制事项"
|
||||
source_types: ["Article", "Obligation"]
|
||||
target_types: ["LegalSubject"]
|
||||
|
||||
defines_spatial:
|
||||
description: "界定空间概念"
|
||||
source_types: ["Article"]
|
||||
target_types: ["SpatialConcept"]
|
||||
|
||||
applies_to:
|
||||
description: "适用于"
|
||||
source_types: ["Article", "AdministrativeProcedure"]
|
||||
target_types: ["LegalSubject"]
|
||||
|
||||
sets_obligation:
|
||||
description: "定义务"
|
||||
source_types: ["Article"]
|
||||
target_types: ["Obligation"]
|
||||
|
||||
prescribes_penalty:
|
||||
description: "规定处罚"
|
||||
source_types: ["Article", "Obligation"]
|
||||
target_types: ["Penalty"]
|
||||
|
||||
requires_procedure:
|
||||
description: "要求程序"
|
||||
source_types: ["Article"]
|
||||
target_types: ["AdministrativeProcedure"]
|
||||
|
||||
procedure_for:
|
||||
description: "程序对应事项"
|
||||
source_types: ["AdministrativeProcedure"]
|
||||
target_types: ["LegalSubject"]
|
||||
|
||||
governs_region:
|
||||
description: "管辖区域"
|
||||
source_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
target_types: ["Region"]
|
||||
|
||||
effective_timeline:
|
||||
description: "生效时间线"
|
||||
source_types: ["Law", "AdministrativeRegulation", "DepartmentalRule"]
|
||||
target_types: ["TimePoint"]
|
||||
|
||||
related_to:
|
||||
description: "相关"
|
||||
source_types: ["Any"]
|
||||
target_types: ["Any"]
|
||||
|
||||
standard_for:
|
||||
description: "标准适用于"
|
||||
source_types: ["PolicyDocument"]
|
||||
target_types: ["LegalSubject"]
|
||||
|
||||
category_index:
|
||||
description: "分类索引"
|
||||
source_types: ["Law", "AdministrativeRegulation", "DepartmentalRule", "PolicyDocument"]
|
||||
target_types: ["LegalSubject"]
|
||||
Reference in New Issue
Block a user