Download src/preprocessing.py from WizardCoder2007/social_media_analyzer: direct link, hf CLI and curl.
- Browser
- Download file 424 Bytes
-
https://huggingface.co/spaces/WizardCoder2007/social_media_analyzer/resolve/main/src/preprocessing.py
- Command line
-
hf download hf://spaces/WizardCoder2007/social_media_analyzer/src/preprocessing.py
-
curl -L -o preprocessing.py https://huggingface.co/spaces/WizardCoder2007/social_media_analyzer/resolve/main/src/preprocessing.py
424 Bytes
| print("preprocessing module loaded") | |
| import re | |
| def clean_text(text): | |
| text = re.sub(r"http\S+", "", text) | |
| text = re.sub(r"\s+", " ", text) | |
| return text.strip() | |
| import re | |
| def clean_text(text: str) -> str: | |
| """ | |
| Basic text normalization for Reddit posts | |
| """ | |
| text = re.sub(r"http\S+", "", text) # remove URLs | |
| text = re.sub(r"\s+", " ", text) # normalize spaces | |
| return text.strip() | |