| import json |
|
|
| |
| with open('ms-swift/matched_scores_2_1.json', 'r', encoding='utf-8') as f: |
| allcorrect_data = json.load(f) |
|
|
| |
| with open('/root/autodl-tmp/600_train/merged_shuffled_train.json', 'r', encoding='utf-8') as f: |
| merged_data = json.load(f) |
|
|
| |
| for entry in allcorrect_data: |
| |
| key = entry.get('key') |
| if key: |
| |
| if key in merged_data: |
| |
| error_type = merged_data[key].get('error_type') |
| entry['error_type'] = error_type |
|
|
| |
| output_file = 'ms-swift/allcorrect_with_error_type.json' |
| with open(output_file, 'w', encoding='utf-8') as f: |
| json.dump(allcorrect_data, f, ensure_ascii=False, indent=2) |
|
|
| print(f"处理完成,结果已保存到 {output_file}") |
|
|
| |
| error_type_stats = {} |
| for entry in allcorrect_data: |
| error_type = entry.get('error_type') |
| if error_type: |
| error_type_stats[error_type] = error_type_stats.get(error_type, 0) + 1 |
| else: |
| error_type_stats['no_error_type'] = error_type_stats.get('no_error_type', 0) + 1 |
|
|
| print("\nError Type 统计:") |
| for error_type, count in error_type_stats.items(): |
| print(f"{error_type}: {count}") |
|
|