Spaces:
Sleeping
Sleeping
Download src/nlp/preprocess.py from LeahRocks/SafeSpaceAI: direct link, hf CLI and curl.
- Browser
- Download file 181 Bytes
-
https://huggingface.co/spaces/LeahRocks/SafeSpaceAI/resolve/main/src/nlp/preprocess.py
- Command line
-
hf download hf://spaces/LeahRocks/SafeSpaceAI/src/nlp/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/spaces/LeahRocks/SafeSpaceAI/resolve/main/src/nlp/preprocess.py
181 Bytes
| import re | |
| def clean_text(text): | |
| text = text.lower() | |
| text = re.sub(r"http\S+", "", text) # remove links | |
| text = re.sub(r"[^a-zA-Z\s]", "", text) | |
| return text.strip() |