moodlens-api / app /utils /text_cleaner.py
kpatel1607's picture
Upload folder using huggingface_hub
1320be7 verified
Raw
History Blame Contribute Delete
249 Bytes
import re
def clean_text(text: str) -> str:
text = str(text)
text = re.sub(
r"http\S+|www\S+",
"",
text
)
text = re.sub(
r"\s+",
" ",
text
)
return text.strip()