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

Method eval_hardness

single_eval.py:363–378  ·  view source on GitHub ↗
(self, sql)

Source from the content-addressed store, hash-verified

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