Download make_items.py from Charvalton/egodeadlines: direct link, hf CLI and curl.
- Browser
- Download file 8.78 kB
-
https://huggingface.co/datasets/Charvalton/egodeadlines/resolve/main/make_items.py
- Command line
-
hf download hf://datasets/Charvalton/egodeadlines/make_items.py
-
curl -L -o make_items.py https://huggingface.co/datasets/Charvalton/egodeadlines/resolve/main/make_items.py
8.78 kB
| """Generate first-person capture items with programmatically known deadline labels. | |
| Each item is a short capture as a personal assistant would receive it (voice memo, | |
| wearable conversation, forwarded email), stamped with the moment it was recorded. | |
| The gold label says whether there is a firm deadline, what it is, and whether an | |
| alarm should be set. Seven trap families, 20 items each. | |
| """ | |
| import calendar, datetime as dt, json, random | |
| SEED = 20261102 | |
| rng = random.Random(SEED) | |
| N = 20 | |
| TASKS = [ | |
| ("the grant application", "the grant portal"), ("the fellowship essay", "the fellowship"), | |
| ("the conference abstract", "the program committee"), ("the visa renewal form", "the consulate"), | |
| ("the quarterly tax estimate", "the IRS"), ("the lease renewal", "the landlord"), | |
| ("the scholarship form", "the scholarship office"), ("the insurance claim", "the insurer"), | |
| ("the DMV appointment paperwork", "the DMV"), ("the hackathon submission", "the organisers"), | |
| ("the internship application", "the hiring team"), ("the reimbursement form", "finance"), | |
| ("the jury duty response", "the court"), ("the residency application", "the program"), | |
| ("the startup accelerator application", "the accelerator"), ("the research proposal", "the department"), | |
| ] | |
| EVENTS = ["the summit", "the demo day", "the workshop", "the info session", "the gala", "the retreat"] | |
| TZS = [("PT", "America/Los_Angeles"), ("ET", "America/New_York"), ("CET", "Europe/Berlin"), | |
| ("AoE", "Etc/GMT+12"), ("SGT", "Asia/Singapore"), ("UTC", "UTC")] | |
| FILLERS = ["um, ", "so, ", "okay so ", "uh, ", "right, ", ""] | |
| MONTHS = list(calendar.month_name) | |
| def ref_moment(): | |
| d = dt.date(2026, 1, 5) + dt.timedelta(days=rng.randrange(0, 540)) | |
| return dt.datetime(d.year, d.month, d.day, rng.randrange(7, 22), rng.randrange(60)) | |
| def fmt_ref(t): | |
| return t.strftime("%a %Y-%m-%d %H:%M") + " Pacific" | |
| def say_date(d, style=None): | |
| style = style or rng.choice(["long", "short", "ordinal"]) | |
| if style == "long": | |
| return f"{MONTHS[d.month]} {d.day}, {d.year}" | |
| if style == "short": | |
| return f"{MONTHS[d.month][:3]} {d.day}" | |
| suf = "th" if 11 <= d.day <= 13 else {1: "st", 2: "nd", 3: "rd"}.get(d.day % 10, "th") | |
| return f"the {d.day}{suf} of {MONTHS[d.month]}" | |
| def wrap(kind, body, speaker_line=None): | |
| """Render a body in one of three capture styles.""" | |
| f = rng.choice(FILLERS) | |
| if kind == "voice_memo": | |
| return f"[voice memo] {f}{body} ...yeah. okay that's it." | |
| if kind == "wearable": | |
| other = speaker_line or "Sounds good, let me know if you need anything." | |
| return f"[wearable, 2 speakers]\nSPEAKER_1: {f}{body}\nSPEAKER_2: {other}" | |
| return f"[forwarded email]\nSubject: Reminder\n\n{body[0].upper() + body[1:]}\n\nBest,\nThe team" | |
| def item(family, ref, kind, text, has, date=None, time=None, tz=None, alarm=None, note=""): | |
| if alarm is None: | |
| alarm = bool(has and date and dt.date.fromisoformat(date) >= ref.date()) | |
| return {"family": family, "capture_kind": kind, "recorded_at": fmt_ref(ref), "text": text, | |
| "gold": {"has_deadline": has, "deadline_date": date, "deadline_time": time, | |
| "timezone": tz, "should_set_alarm": alarm}, "note": note} | |
| def explicit(): | |
| ref = ref_moment(); task, who = rng.choice(TASKS) | |
| d = ref.date() + dt.timedelta(days=rng.randrange(5, 90)) | |
| kind = rng.choice(["voice_memo", "wearable", "email"]) | |
| body = rng.choice([ | |
| f"{task} is due {say_date(d, 'long')}, I need to get that done", | |
| f"{who} said {task} has to be in by {say_date(d, 'long')}", | |
| f"don't forget {task}, the deadline is {say_date(d, 'ordinal')} {d.year}", | |
| ]) | |
| return item("explicit_date", ref, kind, wrap(kind, body), True, d.isoformat()) | |
| def relative(): | |
| ref = ref_moment() | |
| while ref.weekday() > 2: # Mon-Wed, so "this Friday" is unambiguous | |
| ref -= dt.timedelta(days=1) | |
| task, _ = rng.choice(TASKS) | |
| choice = rng.randrange(5) | |
| if choice == 0: | |
| d, phrase = ref.date() + dt.timedelta(days=4 - ref.weekday()), "this Friday" | |
| elif choice == 1: | |
| n = rng.choice([3, 5, 10, 12]); d, phrase = ref.date() + dt.timedelta(days=n), f"in {n} days" | |
| elif choice == 2: | |
| last = calendar.monthrange(ref.year, ref.month)[1] | |
| d, phrase = dt.date(ref.year, ref.month, last), "by the end of this month" | |
| elif choice == 3: | |
| d, phrase = ref.date() + dt.timedelta(days=14), "two weeks from today" | |
| else: | |
| d, phrase = ref.date() + dt.timedelta(days=1), "tomorrow" | |
| kind = rng.choice(["voice_memo", "wearable"]) | |
| body = rng.choice([f"{task} has to be submitted {phrase}", f"I have to finish {task} {phrase}, that's the hard deadline"]) | |
| return item("relative_date", ref, kind, wrap(kind, body), True, d.isoformat(), note=phrase) | |
| def placeholder(): | |
| ref = ref_moment(); task, who = rng.choice(TASKS) | |
| d = ref.date() + dt.timedelta(days=rng.randrange(10, 120)) | |
| kind = rng.choice(["voice_memo", "wearable", "email"]) | |
| body = rng.choice([ | |
| f"{who} put {say_date(d, 'long')} on the calendar for {task} but they said it's just a placeholder, the real date isn't set", | |
| f"the deadline for {task} is TBD. the page shows {say_date(d, 'long')} but it says 'placeholder, to be confirmed'", | |
| f"I wrote {say_date(d, 'short')} for {task} as a guess, I actually have no idea when it's due", | |
| f"{task}: dates to be announced. ignore the {say_date(d, 'short')} in the old flyer, that was last cycle's", | |
| ]) | |
| return item("placeholder_date", ref, kind, wrap(kind, body), False, note="a date appears but is explicitly not real") | |
| def distractor(): | |
| ref = ref_moment(); task, _ = rng.choice(TASKS); ev = rng.choice(EVENTS) | |
| close = ref.date() + dt.timedelta(days=rng.randrange(5, 40)) | |
| event = close + dt.timedelta(days=rng.randrange(7, 30)) | |
| kind = rng.choice(["voice_memo", "wearable", "email"]) | |
| body = rng.choice([ | |
| f"{ev} is on {say_date(event, 'long')}, but registration closes {say_date(close, 'long')} so that's the one that matters", | |
| f"so {ev} happens {say_date(event, 'ordinal')}, and they need {task} before {say_date(close, 'ordinal')}", | |
| f"Registration for {ev} ({say_date(event, 'long')}) closes on {say_date(close, 'long')}.", | |
| ]) | |
| return item("event_vs_deadline", ref, kind, wrap(kind, body), True, close.isoformat(), | |
| note=f"event date {event.isoformat()} is a distractor") | |
| def clock_tz(): | |
| ref = ref_moment(); task, _ = rng.choice(TASKS) | |
| d = ref.date() + dt.timedelta(days=rng.randrange(2, 45)) | |
| hh, mm, spoken = rng.choice([(23, 59, "11:59 PM"), (17, 0, "5 PM"), (12, 0, "noon"), (9, 0, "9 AM"), (18, 30, "6:30 PM")]) | |
| abbr, zone = rng.choice(TZS) | |
| kind = rng.choice(["voice_memo", "email"]) | |
| body = (f"{task} closes {say_date(d, 'long')} at {spoken} {abbr}, not midnight wherever I am" | |
| if kind == "voice_memo" else f"Submissions for {task} are due {say_date(d, 'long')}, {spoken} {abbr}.") | |
| return item("clock_and_timezone", ref, kind, wrap(kind, body), True, d.isoformat(), | |
| f"{hh:02d}:{mm:02d}", zone, note=f"{spoken} {abbr}") | |
| def no_deadline(): | |
| ref = ref_moment(); task, _ = rng.choice(TASKS) | |
| kind = rng.choice(["voice_memo", "wearable"]) | |
| body = rng.choice([ | |
| f"I should really look at {task} at some point, no rush though", | |
| "remind me to call my mom sometime this year, it's been a while", | |
| f"would be nice to clean up {task} eventually, whenever", | |
| f"I keep thinking about {task}. maybe. not urgent.", | |
| "I want to start running again, mornings maybe", | |
| ]) | |
| return item("no_deadline", ref, kind, wrap(kind, body), False) | |
| def conditional(): | |
| ref = ref_moment(); task, _ = rng.choice(TASKS) | |
| kind = rng.choice(["voice_memo", "wearable", "email"]) | |
| body = rng.choice([ | |
| f"once my work permit card arrives I have 30 days to file {task}", | |
| f"{task} is rolling admissions, you can apply anytime", | |
| f"the lawyer said {task} is due 60 days after we get the approval notice, which hasn't come yet", | |
| f"{task} needs to go in within two weeks of the interview, but they haven't scheduled the interview", | |
| ]) | |
| return item("conditional_undated", ref, kind, wrap(kind, body), False, | |
| note="deadline depends on an event that has not happened") | |
| FAMILIES = [explicit, relative, placeholder, distractor, clock_tz, no_deadline, conditional] | |
| items = [] | |
| for fam in FAMILIES: | |
| for _ in range(N): | |
| items.append(fam()) | |
| for i, it in enumerate(items): | |
| it["id"] = f"egd-{i:04d}" | |
| with open("items.jsonl", "w") as f: | |
| for it in items: | |
| f.write(json.dumps(it) + "\n") | |
| print(len(items), "items") | |