Spaces:
Running
Running
Download app/utils.py from cmeneses99/sms-classifier-api: direct link, hf CLI and curl.
- Browser
- Download file 441 Bytes
-
https://huggingface.co/spaces/cmeneses99/sms-classifier-api/resolve/main/app/utils.py
- Command line
-
hf download hf://spaces/cmeneses99/sms-classifier-api/app/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/cmeneses99/sms-classifier-api/resolve/main/app/utils.py
441 Bytes
| import unicodedata | |
| from pathlib import Path | |
| _TEMPLATES = Path(__file__).parent / "templates" | |
| def normalize(text: str) -> str: | |
| """Lowercase and strip accents for cache-key normalization.""" | |
| text = text.lower() | |
| text = unicodedata.normalize("NFD", text) | |
| return "".join(c for c in text if unicodedata.category(c) != "Mn") | |
| def read_static(filename: str) -> str: | |
| return (_TEMPLATES / filename).read_text(encoding="utf-8") | |