"""
Static lexical resources for the lightweight sentiment analyzer.

The values are loosely inspired by rule-based systems such as VADER but
kept intentionally small to avoid large dependencies. Scores are
expressed on roughly the [-4, 4] range where positive numbers indicate
positive affect and negative numbers indicate negative affect.
"""

from __future__ import annotations

POSITIVE_STRONG = {
    "amazing",
    "awesome",
    "brilliant",
    "delightful",
    "fantastic",
    "glorious",
    "incredible",
    "legendary",
    "lovely",
    "outstanding",
    "perfect",
    "phenomenal",
    "spectacular",
    "terrific",
    "wonderful",
}

POSITIVE_COMMON = {
    "adorable",
    "alive",
    "appreciate",
    "balanced",
    "beautiful",
    "beloved",
    "blessed",
    "bold",
    "calm",
    "capable",
    "celebrate",
    "cheerful",
    "chill",
    "clever",
    "comforting",
    "confident",
    "cozy",
    "creative",
    "cute",
    "dope",
    "easy",
    "excited",
    "exciting",
    "excellent",
    "fair",
    "fresh",
    "friendly",
    "fun",
    "funny",
    "future",
    "generous",
    "genius",
    "gentle",
    "good",
    "graceful",
    "grateful",
    "great",
    "gorgeous",
    "happy",
    "healthy",
    "helpful",
    "hero",
    "hilarious",
    "hopeful",
    "hug",
    "inspired",
    "kind",
    "laugh",
    "lol",
    "love",
    "loved",
    "loyal",
    "lucky",
    "nice",
    "peaceful",
    "playful",
    "positive",
    "powerful",
    "proud",
    "pure",
    "relaxed",
    "relief",
    "resilient",
    "safe",
    "savvy",
    "smart",
    "smile",
    "solid",
    "strong",
    "sunny",
    "support",
    "sweet",
    "thankful",
    "thoughtful",
    "thrilled",
    "upbeat",
    "victory",
    "warm",
    "welcome",
    "win",
    "wonder",
    "yay",
    "yes",
}

NEGATIVE_STRONG = {
    "awful",
    "catastrophic",
    "cruel",
    "disgusting",
    "furious",
    "horrible",
    "horrific",
    "hostile",
    "nightmare",
    "painful",
    "pathetic",
    "terrible",
    "toxic",
    "tragic",
    "ugly",
    "worst",
}

NEGATIVE_COMMON = {
    "ache",
    "afraid",
    "angry",
    "annoyed",
    "anxious",
    "ashamed",
    "awkward",
    "bad",
    "bitter",
    "boring",
    "broken",
    "chaos",
    "cold",
    "confused",
    "cry",
    "crying",
    "dead",
    "depressed",
    "difficult",
    "drama",
    "dread",
    "embarrassed",
    "fail",
    "failure",
    "fear",
    "frustrated",
    "frustrating",
    "grief",
    "gross",
    "guilty",
    "hate",
    "hated",
    "helpless",
    "hurt",
    "jealous",
    "late",
    "lonely",
    "mad",
    "messy",
    "miserable",
    "negative",
    "nervous",
    "nope",
    "panic",
    "problem",
    "regret",
    "rough",
    "sad",
    "scared",
    "sick",
    "slow",
    "sorry",
    "stress",
    "stressed",
    "stupid",
    "tired",
    "ughhh",
    "upset",
    "worry",
    "yikes",
}

BOOSTER_WORDS: dict[str, float] = {
    "absolutely": 0.9,
    "barely": -0.4,
    "deeply": 0.5,
    "especially": 0.6,
    "extremely": 0.9,
    "fairly": -0.2,
    "hella": 0.8,
    "incredibly": 0.9,
    "kind": -0.2,
    "kinda": -0.3,
    "mildly": -0.3,
    "pretty": 0.3,
    "quite": 0.4,
    "really": 0.6,
    "slightly": -0.4,
    "so": 0.5,
    "super": 0.8,
    "totally": 0.8,
    "very": 0.7,
}

NEGATIONS = {
    "aint",
    "ain't",
    "aren't",
    "arent",
    "barely",
    "cant",
    "can't",
    "cannot",
    "couldn't",
    "couldnt",
    "didn't",
    "didnt",
    "doesn't",
    "doesnt",
    "don't",
    "dont",
    "hardly",
    "isn't",
    "isnt",
    "neither",
    "never",
    "no",
    "nobody",
    "none",
    "nor",
    "not",
    "nothing",
    "nowhere",
    "shouldn't",
    "shouldnt",
    "without",
    "won't",
    "wouldn't",
    "wouldnt",
}


def _build_lexicon() -> dict[str, float]:
    lexicon: dict[str, float] = {}
    for word in POSITIVE_STRONG:
        lexicon[word] = 3.4
    for word in POSITIVE_COMMON:
        lexicon.setdefault(word, 2.2)
    for word in NEGATIVE_STRONG:
        lexicon[word] = -3.4
    for word in NEGATIVE_COMMON:
        lexicon.setdefault(word, -2.2)
    # Friendly internet slang that often carries sentiment.
    lexicon.update(
        {
            "haha": 2.0,
            "hahaha": 2.4,
            "hehe": 1.6,
            "lolz": 2.0,
            "lmao": 2.4,
            "omg": 1.5,
            "ugh": -1.8,
            "yolo": 1.2,
        }
    )
    return lexicon


LEXICON = _build_lexicon()

__all__ = ["LEXICON", "BOOSTER_WORDS", "NEGATIONS"]
