CoolFace
Apppublic

luli331/oppy_google

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
urgency.py26 linesDownload Raw Back to backend
1_URGENCY_KEYWORDS = [2    "urgent", "bloquant", "blocking", "deadline", "critique", "critical",3    "avant lundi", "avant mardi", "avant mercredi", "asap", "immediatement",4    "pas de reponse", "no reply", "en attente", "waiting", "overdue",5    "sprint review", "livrable", "retard", "action item",6]7 8 9def load_model():10    """No-op — kept for API compatibility."""11    pass12 13 14def score_urgency(email_text: str) -> float:15    """Score how urgent an email is (0-1) using keyword matching."""16    text_lower = email_text.lower()17    keyword_hits = sum(1 for kw in _URGENCY_KEYWORDS if kw in text_lower)18    return round(min(keyword_hits / 3.0, 1.0), 3)19 20 21def score_emails(emails: list[dict]) -> list[dict]:22    """Score a list of email dicts. Adds 'urgency_score' key to each."""23    for email in emails:24        email["urgency_score"] = score_urgency(email["body"])25    return emails26