Download services/validation_service.py from KevsOno/Kevs_Digital_Business_Intelligence: direct link, hf CLI and curl.
- Browser
- Download file 685 Bytes
-
https://huggingface.co/KevsOno/Kevs_Digital_Business_Intelligence/resolve/main/services/validation_service.py
- Command line
-
hf download hf://KevsOno/Kevs_Digital_Business_Intelligence/services/validation_service.py
-
curl -L -o validation_service.py https://huggingface.co/KevsOno/Kevs_Digital_Business_Intelligence/resolve/main/services/validation_service.py
685 Bytes
| import re | |
| FRAMEWORK_SUBS = { | |
| r"\\bSWOT\\b": "strategic review", | |
| r"\\bPESTLE\\b": "market assessment", | |
| r"\\bVRIO\\b": "capability analysis" | |
| } | |
| OVERCONFIDENCE_PATTERNS = [ | |
| re.compile( | |
| r"(guaranteed|100% sure|certain profit)", | |
| re.IGNORECASE | |
| ) | |
| ] | |
| def validate_output(text: str): | |
| cleaned = text | |
| for pattern, replacement in FRAMEWORK_SUBS.items(): | |
| cleaned = re.sub( | |
| pattern, | |
| replacement, | |
| cleaned, | |
| flags=re.IGNORECASE | |
| ) | |
| for pattern in OVERCONFIDENCE_PATTERNS: | |
| cleaned = pattern.sub( | |
| "high probability", | |
| cleaned | |
| ) | |
| return cleaned |