import random # --------------------------------------------------------- # DATA POOLS # --------------------------------------------------------- # list of locations used for synthetic data generation LOCATIONS = [ "Manila", "Marikina", "Quezon City", "Pasig", "Cainta", "Rizal", "Bulacan", "Pampanga", "Cavite", "Batangas", "Laguna", "San Mateo", "Montalban", "Antipolo", "Valenzuela", "Malabon", "Navotas", "Las Pinas", "Taguig", "Makati", "Caloocan", "Muntinlupa", "Paranaque", "Pasay" ] # list of disaster types used for synthetic data generation DISASTERS = [ "baha", "flood", "flooding", "tubig", "bagyo", "typhoon", "storm", "hangin", "ulan", "sunog", "fire", "smoke", "apoy", "lindol", "earthquake", "quake", "aftershock", "landslide", "guho", "mudslide" ] # list of critical keywords used in both urgent and non-urgent samples URGENT_KEYWORDS = [ "tulong", "help", "saklolo", "rescue", "emergency", "evacuate", "need food", "trapped", "stranded", "stuck", "lubog", "buntis" ] # --------------------------------------------------------- # GENERATORS # --------------------------------------------------------- # generates a synthetic urgent post (positive sample) def build_positive(): kw = random.choice(URGENT_KEYWORDS) disaster = random.choice(DISASTERS) loc = random.choice(LOCATIONS) templates = [ f"{kw.upper()} please! {disaster} dito sa {loc}!", f"{loc} need {kw}, {disaster} is rising!", f"Kami po sa {loc} ay need ng {kw}, sobrang taas ng {disaster}!", f"{kw.upper()}! {disaster} sa {loc}, di kami makalabas!", f"Na-trap kami sa {loc} dahil sa {disaster}, {kw} please!", f"{disaster} alert in {loc}, we need {kw} asap!", f"Wala na kaming matatakbuhan sa {loc}, {disaster} na! {kw}!" ] return random.choice(templates) # generates a synthetic non-urgent post (negative sample/trap) def build_negative(): kw = random.choice(URGENT_KEYWORDS) # uses urgent keywords in a safe context disaster = random.choice(DISASTERS) loc = random.choice(LOCATIONS) category = random.choice(["news", "donation", "past", "question"]) # templates that structure the urgent keyword as general news or a report if category == "news": return f"Update: {kw} operations for {disaster} victims in {loc} are ongoing." # templates that structure the urgent keyword as a donation or offering help elif category == "donation": return f"We are sending {kw} and relief goods to {loc}. Stay strong!" # templates that structure the urgent keyword using past tense elif category == "past": return f"Remembering when we were {kw}ed during the last {disaster} in {loc}." # templates that structure the urgent keyword as a general question or advice else: return f"Guys in {loc}, do you need {kw}? Comment below."