Spaces:
Build error
Build error
Download app/utils.py from ARBAJSSHAIKH/ITINFO_AI_PLACEMENT_AGENT: direct link, hf CLI and curl.
- Browser
- Download file 542 Bytes
-
https://huggingface.co/spaces/ARBAJSSHAIKH/ITINFO_AI_PLACEMENT_AGENT/resolve/main/app/utils.py
- Command line
-
hf download hf://spaces/ARBAJSSHAIKH/ITINFO_AI_PLACEMENT_AGENT/app/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/ARBAJSSHAIKH/ITINFO_AI_PLACEMENT_AGENT/resolve/main/app/utils.py
542 Bytes
| import re | |
| def clean_text(text): | |
| # Remove HTML tags | |
| text = re.sub(r'<[^>]*?>', '', text) | |
| # Remove URLs | |
| text = re.sub(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', '', text) | |
| # Remove special characters | |
| text = re.sub(r'[^a-zA-Z0-9 ]', '', text) | |
| # Replace multiple spaces with a single space | |
| text = re.sub(r'\s{2,}', ' ', text) | |
| # Trim leading and trailing whitespace | |
| text = text.strip() | |
| # Remove extra whitespace | |
| text = ' '.join(text.split()) | |
| return text |