import re import random LABEL_MAP_GERMEVAL = {0: "ok", 1: "hass", 2: "beleidigung", 3: "vulgaer"} FLAG_LABELS = {"beleidigung", "hass", "drohung", "belaestigung"} LEET = str.maketrans({"e": "3", "o": "0", "a": "4", "i": "1", "s": "5"}) def clean(text: str) -> str: t = str(text or "") t = re.sub(r"<@!?&?\d+>", "@user", t) t = re.sub(r"@\w+", "@user", t) t = re.sub(r"https?://\S+", "[link]", t) t = re.sub(r"\|LBR\|", " ", t) t = re.sub(r"(.)\1{3,}", r"\1\1\1", t) t = re.sub(r"(? list[str]: out = [text.lower()] words = text.split() if words: i = rng.randrange(len(words)) w = words[i] if len(w) > 3: v = list(words) v[i] = w.lower().translate(LEET) out.append(" ".join(v)) v2 = list(words) k = rng.randrange(len(w)) v2[i] = w[:k] + w[k] * 3 + w[k + 1:] out.append(" ".join(v2)) if len(text) < 60: out.append(text.lower().rstrip(".!?") + " " + rng.choice(["lol", "xd", "digga", "bro", "😂", "🤡"])) return out