132 lines
5.5 KiB
Python
132 lines
5.5 KiB
Python
|
|
"""Hashtag lexicon: maps aliases -> canonical tag.
|
||
|
|
|
||
|
|
Seeded from the research dossier (people, feuds, events, recurring bits).
|
||
|
|
Extend freely; matching is case-insensitive whole-word on each transcript
|
||
|
|
segment, then aggregated per episode and per segment in the FTS index.
|
||
|
|
"""
|
||
|
|
import re
|
||
|
|
|
||
|
|
PEOPLE = {
|
||
|
|
"maddox": ["maddox", "george ochotsk", "ouzounian"],
|
||
|
|
"asterios": ["asterios", "asterios kokkinos", "kokkinos"],
|
||
|
|
"vito": ["vito", "vito gesualdi", "gesualdi"],
|
||
|
|
"sean": ["sean", "seanie"], # Sean the audio engineer
|
||
|
|
"eric_july": ["eric july", "rippaverse", "rippa", "isom", "yaira",
|
||
|
|
"alphacore", "horseman", "backwordz"],
|
||
|
|
"ethan_van_sciver": ["van sciver", "van schiver", "evs", "cyberfrog",
|
||
|
|
"comicsgate", "trashcast"],
|
||
|
|
"razorfist": ["razorfist", "razor fist"],
|
||
|
|
"yellowflash": ["yellowflash", "yellow flash"],
|
||
|
|
"clippa": ["clippa", "young clippa", "riley"],
|
||
|
|
"kevin_landau": ["kevin landau", "landau"],
|
||
|
|
"nick_rekieta": ["rekieta", "rekieta law", "rackets",
|
||
|
|
# whisper phonetic variants observed in transcripts
|
||
|
|
"raketa", "riketa", "rikita", "rakiti", "rakeda",
|
||
|
|
"rikata", "rikade"],
|
||
|
|
"ethan_ralph": ["ralph", "the ralph retort", "killstream", "ralphretort"],
|
||
|
|
"null": ["joshua moon", "kiwi farms", "kiwifarms"],
|
||
|
|
"mumkey_jones": ["mumkey", "mumkey jones"],
|
||
|
|
"josh_denny": ["denny", "josh denny"],
|
||
|
|
"frank_hassle": ["hassle", "frank hassle"],
|
||
|
|
"destiny": ["destiny", "steven bonnell"],
|
||
|
|
"justin_whang": ["whang", "justin whang", "whang!"],
|
||
|
|
"digibro": ["digibro"],
|
||
|
|
"wauterboi": ["waut3rboi", "wauterboi"],
|
||
|
|
"andy_lee": ["andy lee", "callofthedeep"],
|
||
|
|
"cliff_campbell": ["cliff campbell"],
|
||
|
|
"john_morgan": ["john morgan"],
|
||
|
|
"mumkey": [],
|
||
|
|
"greg_boser": ["boser", "greg boser"],
|
||
|
|
"loren_baker": ["loren baker"],
|
||
|
|
"tuomas": ["tuomas", "holmburg", "collector crypt"],
|
||
|
|
"john_mcafee": ["mcafee"],
|
||
|
|
"bunty_king": ["bunty"],
|
||
|
|
"jf_gariepy": ["jf garpey", "gariepy", "jfg"],
|
||
|
|
"sargon": ["sargon"],
|
||
|
|
"boogie2988": ["boogie", "boogie2988"],
|
||
|
|
"kraut": ["kraut"],
|
||
|
|
"andy_warski": ["warski"],
|
||
|
|
"tony_heller": [],
|
||
|
|
"stefan_molyneux": ["molyneux"],
|
||
|
|
"lauren_southern": ["lauren southern", "southern"],
|
||
|
|
"gavin_mcinnes": ["gavin mcinnes", "mcinnes"],
|
||
|
|
"milo": ["milo yiannopoulos", "milo"],
|
||
|
|
"cuck_shack_cast": [],
|
||
|
|
}
|
||
|
|
|
||
|
|
EVENTS = {
|
||
|
|
"lolsuit": ["lolsuit", "lol suit", "lawsuit", "complaint", "deposition",
|
||
|
|
"judge ramos", "greenberger", "subpoena", "dismissed with prejudice"],
|
||
|
|
"isom_lawsuit": ["international school of ministry", "trademark lawsuit",
|
||
|
|
"night letter", "cease and desist"],
|
||
|
|
"patreon_drama": ["patreon"],
|
||
|
|
"deplatforming": ["deplatform", "mastercard", "match list", "visa",
|
||
|
|
"stripe", "paypal", "banking", "backed.by", "backedby"],
|
||
|
|
"seanies": ["seanie", "seanies", "seany award"],
|
||
|
|
"rage_calendar": ["rage calendar", "advent calendar"],
|
||
|
|
"hot_goss": ["hot goss"],
|
||
|
|
"rape_list": ["rape list"],
|
||
|
|
"drunk_sober_high": ["drunk sober high"],
|
||
|
|
"dick_tips": ["dick tip", "dick tips"],
|
||
|
|
"voicemail": ["voicemail", "voice mail"],
|
||
|
|
"rage": ["are you a rage", "the rage"],
|
||
|
|
"isom_review": ["isom #1", "isom review", "grave digger", "tombstone"],
|
||
|
|
"charity_accusations": ["charity"],
|
||
|
|
"new_project2": ["new project 2", "np2"],
|
||
|
|
"web3": ["web3", "nft", "solana", "crypto", "token", "blockchain",
|
||
|
|
"wallet", "mint"],
|
||
|
|
"maddox_book_prank": ["fuck whales", "fuck whales"],
|
||
|
|
"best_debate": ["best debate in the universe"],
|
||
|
|
"biggest_problem": ["biggest problem in the universe", "tbpitu"],
|
||
|
|
}
|
||
|
|
|
||
|
|
TOPICS = {
|
||
|
|
"politics": ["trump", "biden", "obama", "election", "senate", "congress",
|
||
|
|
"democrat", "republican", "libertarian"],
|
||
|
|
"gun_policy": ["second amendment", "nra", "gun control"],
|
||
|
|
"covid": ["covid", "pandemic", "mask", "vaccine", "lockdown", "fauci"],
|
||
|
|
"ukraine_war": ["ukraine", "zelensky", "putin", "russia"],
|
||
|
|
"israel": ["israel", "gaza", "hamas", "idf", "antisemitism"],
|
||
|
|
"ai_tech": ["artificial intelligence", " chatgpt", " openai", " ai ",
|
||
|
|
"machine learning"],
|
||
|
|
"gaming": ["video game", "playstation", "nintendo", "xbox", "steam"],
|
||
|
|
"movies_tv": ["movie", "netflix", "disney", "marvel", "star wars"],
|
||
|
|
"sports": ["nfl", "nba", "ufc", "boxing", "wnba"],
|
||
|
|
"relationships": ["girlfriend", "wife", "divorce", "dating", "marriage"],
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
def build_lexicon() -> list[tuple[str, str, "re.Pattern"]]:
|
||
|
|
"""Returns [(category, canonical_tag, compiled_regex)]."""
|
||
|
|
import re
|
||
|
|
out = []
|
||
|
|
for category, table in (("person", PEOPLE), ("event", EVENTS),
|
||
|
|
("topic", TOPICS)):
|
||
|
|
for tag, aliases in table.items():
|
||
|
|
parts = []
|
||
|
|
for alias in aliases:
|
||
|
|
a = alias.strip()
|
||
|
|
if not a:
|
||
|
|
continue
|
||
|
|
esc = re.escape(a)
|
||
|
|
if a[:1].isalnum():
|
||
|
|
esc = r"\b" + esc
|
||
|
|
if a[-1:].isalnum():
|
||
|
|
esc = esc + r"\b"
|
||
|
|
parts.append(esc)
|
||
|
|
if not parts:
|
||
|
|
continue
|
||
|
|
rx = re.compile("|".join(parts), re.IGNORECASE)
|
||
|
|
out.append((category, tag, rx))
|
||
|
|
return out
|
||
|
|
|
||
|
|
|
||
|
|
def tags_for_text(text: str, lexicon=None) -> list[str]:
|
||
|
|
if lexicon is None:
|
||
|
|
lexicon = build_lexicon()
|
||
|
|
found = []
|
||
|
|
for _cat, tag, rx in lexicon:
|
||
|
|
if rx.search(text):
|
||
|
|
found.append(tag)
|
||
|
|
return found
|