Args: pred (TYPE): NULL gold (TYPE): NULL Returns: TODO Raises: NULL
(pred, gold)
| 981 | |
| 982 | |
| 983 | def 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 | |
| 1015 | def eval_where(pred, gold): |
no test coverage detected