(executor, result, prompt_type, data_name, execute=False, azr=False)
| 745 | |
| 746 | |
| 747 | def run_execute(executor, result, prompt_type, data_name, execute=False, azr=False): |
| 748 | if not result or result == "error": |
| 749 | return None, None |
| 750 | report = None |
| 751 | |
| 752 | if azr: |
| 753 | prediction = extract_azr_answer(result, extraction_type="answer", data_name=data_name) |
| 754 | elif "program_only" in prompt_type: |
| 755 | prediction = extract_program_output(result) |
| 756 | elif prompt_type in ["pot", "pal"] and execute: |
| 757 | code = extract_program(result) |
| 758 | prediction, report = executor.apply(code) |
| 759 | else: |
| 760 | prediction = extract_answer(result, data_name) |
| 761 | |
| 762 | # prediction = strip_string(prediction, skip_unit=data_name == "carp_en") |
| 763 | prediction = strip_string(prediction, skip_unit=data_name in STRIP_EXCEPTIONS) |
| 764 | return prediction, report |
| 765 | |
| 766 | |
| 767 | def _test_extract_answer(): |
no test coverage detected