Spaces:
Sleeping
Sleeping
Download src/preprocess.py from Vivekkrishu/chatbot: direct link, hf CLI and curl.
- Browser
- Download file 245 Bytes
-
https://huggingface.co/spaces/Vivekkrishu/chatbot/resolve/main/src/preprocess.py
- Command line
-
hf download hf://spaces/Vivekkrishu/chatbot/src/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/spaces/Vivekkrishu/chatbot/resolve/main/src/preprocess.py
245 Bytes
| import re | |
| import string | |
| def clean_text(text: str) -> str: | |
| """Lowercase, remove punctuation, and clean text""" | |
| text = text.lower() | |
| text = re.sub(f"[{re.escape(string.punctuation)}]", "", text) | |
| text = text.strip() | |
| return text | |