| # 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-v9.json", "r", encoding="utf-8")) | |
| # new_wrong_code_base_dict = {} | |
| # update_list = {} | |
| # for k, v in new_wrong_code_base.items(): | |
| # tcb_id = get_transformed_id(k) | |
| # if tcb_id not in new_wrong_code_base_dict.keys(): | |
| # update_list[tcb_id] = [ | |
| # {k:v} | |
| # ] | |
| # else: | |
| # update_list[tcb_id].append({k:v}) | |
| # new_wrong_code_base_dict[tcb_id] = v | |
| # multiple_list = {} | |
| # for k, v in update_list.items(): | |
| # if len(v) == 1: | |
| # continue | |
| # for item in v: | |
| # multiple_list.update(item) | |
| # json.dump(multiple_list, open(f"/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/to_update.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False) | |
| # # json.dump(tcb_bench, open(f"/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/TestcaseBench-v10.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False) | |
| wrong_match = { | |
| "重建": "#6075. 「2017 山东一轮集训 Day6」重建", | |
| "第一题": "#6065. 「2017 山东一轮集训 Day3」第一题", | |
| "选课": "#3331. 「WC2020」选课", | |
| "字符串": "#6031. 「雅礼集训 2017 Day1」字符串", | |
| "Censoring": "#10059. 「一本通 2.4 练习 2」Censoring" | |
| } | |
| import json | |
| 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")) | |
| wrong_code_base = json.load(open("/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/balance_v2.0_with_code.json", "r", encoding="utf-8")) | |
| tcb_bench = json.load(open("/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/TestcaseBench-v10.json", "r", encoding="utf-8")) | |
| for item in tcb_bench: | |
| if item['tcb_id'] in wrong_match.keys(): | |
| item['wrong_code'] = new_wrong_code_base[wrong_match[item['tcb_id']]]['cowrong_codes'] | |
| json.dump(tcb_bench, open(f"/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/TestcaseBench-v11.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False) | |
Xet Storage Details
- Size:
- 2.64 kB
- Xet hash:
- 3fe211fcb015f136c9d2114d626468973850a3ec18ba17068d1a3c07128df6e9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.