Spaces:
Sleeping
Sleeping
Download utils/evaluator.py from anusha1840/HackRx: direct link, hf CLI and curl.
- Browser
- Download file 825 Bytes
-
https://huggingface.co/spaces/anusha1840/HackRx/resolve/main/utils/evaluator.py
- Command line
-
hf download hf://spaces/anusha1840/HackRx/utils/evaluator.py
-
curl -L -o evaluator.py https://huggingface.co/spaces/anusha1840/HackRx/resolve/main/utils/evaluator.py
825 Bytes
| def evaluate(parsed_query: dict, matched_clause: str) -> dict: | |
| procedure = parsed_query.get("procedure", "") | |
| duration = parsed_query.get("policy_duration", "") | |
| if not matched_clause or not procedure: | |
| return { | |
| "decision": "rejected", | |
| "justification": "Unable to match clause or detect procedure from query.", | |
| "amount": "₹0" | |
| } | |
| if procedure.lower() in matched_clause.lower(): | |
| return { | |
| "decision": "approved", | |
| "justification": f"{procedure.capitalize()} is covered under the policy. Clause matched.", | |
| "amount": "₹80,000" | |
| } | |
| return { | |
| "decision": "rejected", | |
| "justification": "Procedure not clearly mentioned in policy document.", | |
| "amount": "₹0" | |
| } | |