What problem does it solve?
hara-stage0 turns a HARA “功能文档” (or its source_extraction JSON) into a strictly structured, deterministic function mapping file, so downstream stages can perform analysis using only the extracted function scope rather than guessing from risk knowledge.
Core Features & Use Cases
- 功能清单驱动的功能提取: Extracts only the functions listed in the table column whose header is exactly “功能”, and does not invent functions from正文标题.
- detail_text 原文聚合: For each function, bundles the matched功能标题及其所有子级标题与内容 into detail_text, excluding images and preserving original technical wording.
- 输出可直接用于 Stage 1/2/3: Produces
output/<RUN_ID>_stage0_function_mapping.json, optionally generating per-function context files for faster downstream processing.
Quick Start
Run stage0 from a normalized function document by executing: python tools/hara/generate_stage0_function_mapping.py --input <function_doc_path> --out output/<RUN_ID>_stage0_function_mapping.json --run-id <RUN_ID> --write-contexts