darshsingh1 commited on
Commit
8b7db34
·
verified ·
1 Parent(s): efc488b

Upload server/graders.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. server/graders.py +10 -10
server/graders.py CHANGED
@@ -30,7 +30,7 @@ def _partial_overlap(a: list, b: list) -> float:
30
  Used for partial credit scoring.
31
  """
32
  if not b:
33
- return 1.0 if not a else 0.0
34
  norm_a = set(map(tuple, _normalize_rows(a)))
35
  norm_b = set(map(tuple, _normalize_rows(b)))
36
  overlap = len(norm_a & norm_b)
@@ -47,12 +47,12 @@ def grade_easy(
47
  error: Optional[str],
48
  ) -> float:
49
  if error is not None:
50
- return 0.0
51
 
52
  if _rows_match(output or [], reference):
53
- return 1.0
54
 
55
- return 0.0
56
 
57
 
58
  # ---------------------------------------------------------------------------
@@ -67,7 +67,7 @@ def grade_medium(
67
  cumulative_errors: int = 0,
68
  ) -> float:
69
  if error is not None:
70
- return 0.0
71
 
72
  q = query_str.lower()
73
  has_left_join = "left join" in q
@@ -76,9 +76,9 @@ def grade_medium(
76
  both_fixed = has_left_join and has_gte_date
77
 
78
  if both_fixed and _rows_match(output or [], reference):
79
- return 1.0
80
 
81
- return 0.0
82
 
83
 
84
  # ---------------------------------------------------------------------------
@@ -92,7 +92,7 @@ def grade_hard(
92
  query_str: str,
93
  ) -> float:
94
  if error is not None:
95
- return 0.0
96
 
97
  q = query_str.lower()
98
  has_group_by = "group by" in q
@@ -100,6 +100,6 @@ def grade_hard(
100
  exact_match = _rows_match(output or [], reference)
101
 
102
  if exact_match and has_group_by:
103
- return 1.0
104
 
105
- return 0.0
 
30
  Used for partial credit scoring.
31
  """
32
  if not b:
33
+ return 0.9 if not a else 0.1
34
  norm_a = set(map(tuple, _normalize_rows(a)))
35
  norm_b = set(map(tuple, _normalize_rows(b)))
36
  overlap = len(norm_a & norm_b)
 
47
  error: Optional[str],
48
  ) -> float:
49
  if error is not None:
50
+ return 0.1
51
 
52
  if _rows_match(output or [], reference):
53
+ return 0.9
54
 
55
+ return 0.1
56
 
57
 
58
  # ---------------------------------------------------------------------------
 
67
  cumulative_errors: int = 0,
68
  ) -> float:
69
  if error is not None:
70
+ return 0.1
71
 
72
  q = query_str.lower()
73
  has_left_join = "left join" in q
 
76
  both_fixed = has_left_join and has_gte_date
77
 
78
  if both_fixed and _rows_match(output or [], reference):
79
+ return 0.9
80
 
81
+ return 0.1
82
 
83
 
84
  # ---------------------------------------------------------------------------
 
92
  query_str: str,
93
  ) -> float:
94
  if error is not None:
95
+ return 0.1
96
 
97
  q = query_str.lower()
98
  has_group_by = "group by" in q
 
100
  exact_match = _rows_match(output or [], reference)
101
 
102
  if exact_match and has_group_by:
103
+ return 0.9
104
 
105
+ return 0.1