#!/usr/bin/env python3 """Generate a synthetic, PII-free support-ticket dataset for the HF bait repo. Deterministic (seeded) so re-runs are stable. No real people, companies, or systems are referenced. Scale ROWS up if you want a heavier-looking repo. """ import json, random, argparse, os SEED = 1337 random.seed(SEED) CATEGORIES = ["billing", "technical", "account", "shipping", "feedback"] TEMPLATES = { "billing": [ "I was charged twice for order {oid} this month, can you refund the duplicate?", "My invoice for plan {plan} shows the wrong amount, it should be ${amt}.", "Why did my subscription renew at a higher price than last {period}?", "Please cancel the pending charge on order {oid}, I did not authorize it.", "The promo code did not apply at checkout for order {oid}.", ], "technical": [ "The dashboard fails to load after the latest update, I just get a blank page.", "Export to CSV times out whenever I select more than {n} rows.", "API returns a 500 on the /reports endpoint since yesterday.", "The mobile app crashes on launch on version {ver}.", "Two-factor codes are never delivered to my authenticator app.", ], "account": [ "I can't reset my password, the reset email never arrives.", "Please merge my two accounts, I signed up twice by mistake.", "How do I change the primary email on my workspace?", "My account was downgraded to free but I am still on the paid plan.", "I need to add {n} more seats to my team plan.", ], "shipping": [ "Order {oid} has been stuck in 'processing' for {n} days.", "The tracking number for order {oid} shows no updates.", "I received the wrong item in order {oid}.", "Can I change the delivery address on order {oid} before it ships?", "Package for order {oid} arrived damaged.", ], "feedback": [ "The new layout is much easier to navigate, nice work.", "It would help to have a dark mode in the reporting view.", "Search is slow when the project has many items.", "Please add keyboard shortcuts for the common actions.", "Onboarding was smooth but the docs for {plan} are thin.", ], } PLANS = ["starter", "team", "business", "enterprise"] PERIODS = ["month", "quarter", "year"] VERS = ["3.2.1", "3.3.0", "4.0.0", "4.1.2"] def fill(t): return t.format( oid=f"{random.randint(100000, 999999)}", plan=random.choice(PLANS), amt=f"{random.randint(9, 499)}.{random.randint(0,99):02d}", period=random.choice(PERIODS), n=random.choice([5, 10, 25, 50, 100, 1000, 5000]), ver=random.choice(VERS), ) def make_rows(n, start_id=0): rows = [] for i in range(n): cat = random.choice(CATEGORIES) text = fill(random.choice(TEMPLATES[cat])) rows.append({ "id": start_id + i, "text": text, "label": cat, "priority": random.choice(["low", "normal", "high"]), }) return rows def write_jsonl(path, rows): with open(path, "w") as f: for r in rows: f.write(json.dumps(r) + "\n") if __name__ == "__main__": ap = argparse.ArgumentParser() ap.add_argument("--out", default=".") ap.add_argument("--train", type=int, default=800) ap.add_argument("--val", type=int, default=200) args = ap.parse_args() os.makedirs(args.out, exist_ok=True) train = make_rows(args.train, 0) val = make_rows(args.val, args.train) write_jsonl(os.path.join(args.out, "train.jsonl"), train) write_jsonl(os.path.join(args.out, "validation.jsonl"), val) print(f"wrote {len(train)} train / {len(val)} val rows to {args.out}")