MCPcopy Create free account
hub / github.com/InternScience/SciReason / bbeh_mcq_postprocess

Function bbeh_mcq_postprocess

opencompass/datasets/bbeh.py:61–80  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

59
60@TEXT_POSTPROCESSORS.register_module('bbeh_mcq')
61def bbeh_mcq_postprocess(text: str) -> str:
62 # Extract answer using specified prefixes
63 prefixes = [
64 'The answer is: ', 'The answer is ', 'The final answer is: ',
65 'The final answer is '
66 ]
67 answer = text
68 for prefix in prefixes:
69 if prefix in text:
70 answer = text.split(prefix)[-1]
71 break
72
73 # Remove parentheses if present
74 answer = answer.strip('()')
75
76 # Take first line and clean
77 if '\n' in answer:
78 answer = answer.split('\n')[0].strip()
79
80 return answer.strip().lower()
81
82
83@ICL_EVALUATORS.register_module()

Callers 1

scoreMethod · 0.85

Calls 1

lowerMethod · 0.45

Tested by

no test coverage detected