(dataset_name, num_right, num_error, total_nums, method)
| 127 | return False |
| 128 | |
| 129 | def save_result2json(dataset_name, num_right, num_error, total_nums, method): |
| 130 | results_data = { |
| 131 | 'dataset': dataset_name, |
| 132 | 'method': method, |
| 133 | 'Exact Match': float(num_right/total_nums), |
| 134 | 'Right Samples': num_right, |
| 135 | 'Error Sampels': num_error |
| 136 | } |
| 137 | with open('ToG_{}_results.json'.format(dataset_name), 'w', encoding='utf-8') as f: |
| 138 | json.dump(results_data, f, ensure_ascii=False, indent=4) |
| 139 | |
| 140 | def extract_content(s): |
| 141 | matches = re.findall(r'\{(.*?)\}', s) |