Download chatbot/src/preprocess.py from Vivekkrishu/Chatbot: direct link, hf CLI and curl.
- Browser
- Download file 254 Bytes
-
https://huggingface.co/Vivekkrishu/Chatbot/resolve/main/chatbot/src/preprocess.py
- Command line
-
hf download hf://Vivekkrishu/Chatbot/chatbot/src/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/Vivekkrishu/Chatbot/resolve/main/chatbot/src/preprocess.py
254 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 | |