Extracts the content of the … block from `predict`. Returns the inner text (with leading/trailing whitespace stripped), or None if no tag is found.
(predict: str)
| 80 | return 1.0 if pattern.fullmatch(predict.strip()) else 0.0 |
| 81 | |
| 82 | def extract_description(predict: str) -> Optional[str]: |
| 83 | """ |
| 84 | Extracts the content of the <answer>…</answer> block from `predict`. |
| 85 | Returns the inner text (with leading/trailing whitespace stripped), |
| 86 | or None if no <answer> tag is found. |
| 87 | """ |
| 88 | match = re.search(r"<description>([\s\S]*?)</description>", predict, re.DOTALL) |
| 89 | if not match: |
| 90 | return predict |
| 91 | return match.group(1).strip() |
| 92 | |
| 93 | def extract_answer(predict: str) -> Optional[str]: |
| 94 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected