Spaces:
Runtime error
Runtime error
| # model-fastapi/preprocessing.py | |
| import re | |
| import emoji | |
| def clean_text(t): | |
| t = str(t).lower() | |
| t = re.sub(r"http\S+|www\.\S+", "", t) | |
| t = re.sub(r"@\w+", "", t) | |
| t = re.sub(r"#(\w+)", r"\1", t) | |
| t = re.sub(r"\s+", " ", t).strip() | |
| # Jika Anda menggunakan emoji.replace_emoji() di Colab, pastikan versi Python Anda mendukungnya, atau gunakan pustaka yang diimpor. | |
| # Contoh: t = emoji.replace_emoji(t, replace="") | |
| return t | |
| def preprocess_text(text: str) -> str: | |
| return clean_text(text) |