MCPcopy Create free account
hub / github.com/PRIME-RL/PRIME / match_code

Function match_code

eval/Coding/mbpp/evaluate_mbpp.py:21–38  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

19
20STOP_WORDS = []
21def match_code(s):
22 pattern = r'```python(.*?)```'
23 sol = re.findall(pattern, s, re.DOTALL)
24 if len(sol) > 0:
25 for code_block in reversed(sol):
26 if 'def ' in code_block:
27 return code_block
28 return sol[-1]
29
30 pattern = r'```(.*?)```'
31 sol = re.findall(pattern, s, re.DOTALL)
32 if len(sol) > 0:
33 for code_block in reversed(sol):
34 if 'def ' in code_block:
35 return code_block
36 return sol[-1]
37
38 return s.split('```')[0]
39
40def generate_sample_batch(question_list):
41 llm = LLM(

Callers 1

generate_sample_batchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected