sms-classifier-api / app /utils.py
cmeneses99's picture
Initial deploy: SMS Classifier API
f9ac587
raw
history blame
365 Bytes
import unicodedata
from pathlib import Path
_STATIC = Path(__file__).parent / "static"
def normalize(text: str) -> str:
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 (_STATIC / filename).read_text(encoding="utf-8")