MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / eval_cond

Function eval_cond

NLP/Text2SQL-BASELINE/text2sql/utils/dusql_evaluation.py:983–1012  ·  view source on GitHub ↗

Args: pred (TYPE): NULL gold (TYPE): NULL Returns: TODO Raises: NULL

(pred, gold)

Source from the content-addressed store, hash-verified

981
982
983def eval_cond(pred, gold):
984 """
985
986 Args:
987 pred (TYPE): NULL
988 gold (TYPE): NULL
989
990 Returns: TODO
991
992 Raises: NULL
993 """
994 def _equal(p, g):
995 if str(p) == str(g):
996 return True
997 p = p.strip('"\'') if type(p) is str else p
998 g = g.strip('"\'') if type(g) is str else g
999 if text_utils.is_float(p) and text_utils.is_float(g) and float(p) == float(g):
1000 return True
1001 return False
1002
1003 if type(gold[3]) is dict:
1004 return eval_nested_cond(pred, gold)
1005
1006 if pred[:3] != gold[:3]:
1007 return 0
1008
1009 if _equal(pred[3], gold[3]) and _equal(pred[4], gold[4]):
1010 return 1
1011 else:
1012 return 0
1013
1014
1015def eval_where(pred, gold):

Callers 2

eval_whereFunction · 0.70
eval_havingFunction · 0.70

Calls 2

eval_nested_condFunction · 0.70
_equalFunction · 0.70

Tested by

no test coverage detected