MCPcopy Create free account
hub / github.com/FusionBrainLab/SONAR-LLM / get_final_marks

Function get_final_marks

gpt_eval.py:16–36  ·  view source on GitHub ↗
(scores)

Source from the content-addressed store, hash-verified

14
15
16def get_final_marks(scores):
17 pattern = re.compile(r"\d*/\d*")
18 subj_scores = scores.split("\n")
19 subj_scores_dict = {}
20 for subj_score in subj_scores:
21 try:
22 if "grammar" in subj_score.lower():
23 label = pattern.findall(subj_score)
24 subj_scores_dict["grammar"] = float(label[0].split("/")[0])
25 elif "creativity" in subj_score.lower():
26 label = pattern.findall(subj_score)
27 subj_scores_dict["creativity"] = float(label[0].split("/")[0])
28 elif "consistency" in subj_score.lower():
29 label = pattern.findall(subj_score)
30 subj_scores_dict["consistency"] = float(label[0].split("/")[0])
31 elif "plot" in subj_score.lower():
32 label = pattern.findall(subj_score)
33 subj_scores_dict["plot"] = float(label[0].split("/")[0])
34 except Exception as e:
35 continue
36 return subj_scores_dict
37
38
39def get_message_1(story_prompt, generation):

Callers 1

get_gpt_evalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected