| import json | |
| import re | |
| from collections import defaultdict | |
| def get_transformed_id(problem_id): | |
| if "地底蔷薇" in problem_id: | |
| return "地底蔷薇" | |
| tcb_id = problem_id.replace('/', ' ') | |
| tcb_id = re.sub(r'^[^.]*\.', '', tcb_id) | |
| i = tcb_id.find('」') | |
| if i != -1: | |
| tcb_id = tcb_id[i+1:] | |
| tcb_id = tcb_id.strip() | |
| if tcb_id == "": | |
| print(problem_id) | |
| return problem_id | |
| return tcb_id | |
| new_wrong_code_base = json.load(open("/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/balance_v1.0.dev_with_code.json", "r", encoding="utf-8")) | |
| tcb_bench = json.load(open("/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/TestcaseBench-v6.json", "r", encoding="utf-8")) | |
| new_wrong_code_base_dict = {} | |
| for k, v in new_wrong_code_base.items(): | |
| tcb_id = get_transformed_id(k) | |
| new_wrong_code_base_dict[tcb_id] = v['cowrong_codes'] | |
| update = 0 | |
| for item in tcb_bench: | |
| if item['tcb_id'] not in new_wrong_code_base_dict.keys(): | |
| item['wrong_code'] = item['wrong_code']['wrong_code'] | |
| continue | |
| item['wrong_code'] = new_wrong_code_base_dict[item['tcb_id']] | |
| update += 1 | |
| print(update) | |
| json.dump(tcb_bench, open(f"/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/TestcaseBench-v7.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False) | |
Xet Storage Details
- Size:
- 1.3 kB
- Xet hash:
- 7231b22c07ec79cf5b8568ce5eddded74d609c3f4ae91a0765e3f36829f12e9c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.