Input a string like below: xxx[[5]]xxx, and extract the score
(judgement: str)
| 9 | |
| 10 | |
| 11 | def post_process(judgement: str): |
| 12 | """Input a string like below: |
| 13 | |
| 14 | xxx[[5]]xxx, and extract the score |
| 15 | """ |
| 16 | judgement = judgement['prediction'] |
| 17 | pattern = r'\[\[([\d.]+)\]\]' |
| 18 | matched_result = re.findall(pattern, judgement) |
| 19 | if matched_result: |
| 20 | score = float(matched_result[0]) |
| 21 | else: |
| 22 | return None |
| 23 | return {'score': score} |
| 24 | |
| 25 | |
| 26 | def get_capability_results(judged_answers, references): |
no outgoing calls
no test coverage detected