-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluator.py
More file actions
27 lines (22 loc) · 735 Bytes
/
Copy pathevaluator.py
File metadata and controls
27 lines (22 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def evaluate(output, correct, difficulty="hard"):
score = 0
if difficulty == "easy":
if output["issue"] == correct["issue"]:
score = 1.0
return score
if difficulty == "medium":
if output["issue"] == correct["issue"]:
score += 0.5
if output["action"] == correct["action"]:
score += 0.5
return score
# hard — 4 components
if output["issue"] == correct["issue"]:
score += 0.25
if output["action"] == correct["action"]:
score += 0.25
if len(output.get("reply", "")) > 30:
score += 0.25
if output["action"] in output.get("reply", "").lower():
score += 0.25
return max(0.0, min(score, 1.0))