MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / eval_hardness

Method eval_hardness

evaluation/test-suite-sql-eval/evaluation.py:362–377  ·  view source on GitHub ↗
(self, sql)

Source from the content-addressed store, hash-verified

360 self.partial_scores = None
361
362 def eval_hardness(self, sql):
363 count_comp1_ = count_component1(sql)
364 count_comp2_ = count_component2(sql)
365 count_others_ = count_others(sql)
366
367 if count_comp1_ <= 1 and count_others_ == 0 and count_comp2_ == 0:
368 return "easy"
369 elif (count_others_ <= 2 and count_comp1_ <= 1 and count_comp2_ == 0) or \
370 (count_comp1_ <= 2 and count_others_ < 2 and count_comp2_ == 0):
371 return "medium"
372 elif (count_others_ > 2 and count_comp1_ <= 2 and count_comp2_ == 0) or \
373 (2 < count_comp1_ <= 3 and count_others_ <= 2 and count_comp2_ == 0) or \
374 (count_comp1_ <= 1 and count_others_ == 0 and count_comp2_ <= 1):
375 return "hard"
376 else:
377 return "extra"
378
379 def eval_exact_match(self, pred, label):
380 partial_scores = self.eval_partial_match(pred, label)

Callers 1

evaluateFunction · 0.95

Calls 3

count_component1Function · 0.70
count_component2Function · 0.70
count_othersFunction · 0.70

Tested by

no test coverage detected