67 lines
2.5 KiB
Python
67 lines
2.5 KiB
Python
"""structure_ontology.yaml 의 11 문제 frame 에 structure_intent list 추가 (1회용).
|
|
|
|
대상 매핑:
|
|
13 three_parallel_requirements → [requirement_list]
|
|
14 three_persona_benefits → [persona_benefit]
|
|
17 bim_current_problems_paired → [problem_diagnosis]
|
|
18 bim_dx_comparison_table → [concept_comparison, multi_attribute_comparison]
|
|
20 dx_sw_necessity_three_perspectives → [requirement_or_pillar]
|
|
23 app_sw_package_vs_solution → [concept_comparison, multi_attribute_comparison]
|
|
24 engn_sw_three_types → [category_comparison, multi_attribute_comparison]
|
|
28 sw_reality_three_emphasis → [problem_diagnosis]
|
|
29 process_product_two_way → [process_product_split, transformation_story]
|
|
30 industry_current_status_three_col → [industry_comparison, multi_attribute_comparison]
|
|
31 industry_characteristics_three_col → [industry_comparison, multi_attribute_comparison]
|
|
|
|
나머지 21 frames: intent 없음 (neutral 0.5 처리 예정).
|
|
"""
|
|
import sys
|
|
import shutil
|
|
from pathlib import Path
|
|
import yaml
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
HERE = Path(__file__).parent
|
|
|
|
INTENT_MAP = {
|
|
'13': ['requirement_list'],
|
|
'14': ['persona_benefit'],
|
|
'17': ['problem_diagnosis'],
|
|
'18': ['concept_comparison', 'multi_attribute_comparison'],
|
|
'20': ['requirement_or_pillar'],
|
|
'23': ['concept_comparison', 'multi_attribute_comparison'],
|
|
'24': ['category_comparison', 'multi_attribute_comparison'],
|
|
'28': ['problem_diagnosis'],
|
|
'29': ['process_product_split', 'transformation_story'],
|
|
'30': ['industry_comparison', 'multi_attribute_comparison'],
|
|
'31': ['industry_comparison', 'multi_attribute_comparison'],
|
|
}
|
|
|
|
|
|
def main():
|
|
path = HERE / "structure_ontology.yaml"
|
|
bak = HERE / "structure_ontology.yaml.pre_intent.bak"
|
|
shutil.copy(path, bak)
|
|
print(f"[1] 백업: {bak}")
|
|
|
|
with open(path, encoding='utf-8') as f:
|
|
data = yaml.safe_load(f)
|
|
|
|
updated = 0
|
|
for fid, tpl in data.get('templates_v1', {}).items():
|
|
sid = tpl.get('short_id', '?')
|
|
if sid in INTENT_MAP:
|
|
vp = tpl.setdefault('visual_pattern', {})
|
|
vp['structure_intent'] = INTENT_MAP[sid]
|
|
updated += 1
|
|
print(f" {sid} {tpl['template_id']}: {INTENT_MAP[sid]}")
|
|
|
|
with open(path, 'w', encoding='utf-8') as f:
|
|
yaml.safe_dump(data, f, allow_unicode=True, sort_keys=False, width=120)
|
|
|
|
print(f"[2] 저장 완료: {updated} frame 갱신")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|