தேதிகள் Jev 1.13 jaggedness-இன் textbook case: model "August 14"-ஐ text-ஆக வாசிக்கிறது, ordered quantity-ஆக அல்ல; எனவே எந்த date முதலில், இரண்டு தேதிகளுக்கு இடையே எவ்வளவு இடைவெளி என்பது தவறாகும் – mixed formats, "next Thursday", quarters போன்ற domain எல்லைகளில் மேலும் மோசம். TypeSafe-இன் date-extraction cookbook நிலைக்கும் தீர்வைக் காட்டுகிறது: ஏழு Choice கேள்விகள் ஒரே call-இல் தேதியின் shape + பகுதிகளை text-லிருந்து படிக்கும்; சாதாரண code பதில்களை உண்மையான date-ஆக மாற்றும், relative தேதிகளுக்கு இன்றிலிருந்து எண்ணி, பலவீன வாசிப்புகளை மனிதரிடம் அனுப்பும் confidence gate-உடன். இந்த guide recipe-யின் சுருக்கம், key code shape-உடன்.

இறுதியில் ஒரு function கிடைக்கும், extract_date(document, role): document + "the deadline to return the form" போன்ற phrase கொடுங்கள், date + confidence பெறுங்கள் – அல்லது அப்படி ஒரு date இல்லை என்ற flag, அல்லது ஒருவர் பார்க்க வேண்டும் என்ற flag.

Pattern: பகுதிகளுக்கு Choices, calendar-க்கு code

தேதியின் ஒவ்வொரு பகுதியும் சிறு closed set – பன்னிரண்டு மாதங்கள், முப்பத்தொரு நாட்கள், bounded ஆண்டுகள் – எனவே extraction free-form parsing-க்குப் பதில் enumerated options மீதான Choice ஆகிறது, explicit "not stated" escape-உடன்; காணாமல் போன பகுதி guess செய்யப்படாமல் report செய்யப்படும். ஏழு கேள்விகள்:

Code mode கேட்கும் pieces-ஐ மட்டும் படித்து, date-ஐ assemble செய்து, பயன்படுத்திய பகுதிகளில் குறைந்த confidence-ஐ report செய்யும் – ஒரு பலவீனப் பகுதி முழு date-ஐயும் review-க்கு அனுப்பும். 0.60-க்குக் கீழ் எதுவும், code assemble செய்ய முடியாத எதுவும் மனிதரிடம் செல்லும்; மற்றவை நேராக through.

Code-இல் கேள்விகள்

def date_questions(role: str) -> dict[str, Choice]:
    """Seven typed choices that read a date's shape and parts off the text -- no math."""
    absent = "The document does not state this, or it is not this kind of date."
    return {
        "mode": Choice(
            instructions=(
                f"How is {role} written? 'absolute' = a calendar date naming a month; "
                "'relative' = relative to today; 'none' = the document does not state it."
            ),
            criteria={"absolute": None, "relative": None, "none": None},
        ),
        "month": Choice(
            instructions=f"If {role} is an absolute calendar date, which month is it in?",
            criteria={m: None for m in MONTHS} | {"none": absent},
        ),
        "day": Choice(
            instructions=f"If {role} is an absolute calendar date, which day (1-31)?",
            criteria={str(d): None for d in range(1, 32)} | {"none": absent},
        ),
        "year": Choice(
            instructions=(
                f"If {role} is an absolute calendar date, which year? 'none' if unstated "
                "(code infers it), 'out_of_range' if stated but off the list."
            ),
            criteria={str(y): None for y in YEAR_WINDOW}
            | {"out_of_range": "Stated but outside the listed range.",
               "none": "No year is stated."},
        ),
        "day_anchor": Choice(
            instructions=f"If {role} is relative to today, which day is it?",
            criteria={"today": None, "tomorrow": None, "day_after": None,
                      "weekday": None, "none": absent},
        ),
        "weekday": Choice(
            instructions=f"If {role} names a day of the week, which one?",
            criteria={w: None for w in WEEKDAYS} | {"none": absent},
        ),
        "week_offset": Choice(
            instructions=f"If {role} names a weekday, which week?",
            criteria={"current": None, "next": None, "none": absent},
        ),
    }

Code-இல் resolve செய்க

Assemble step வேண்டுமென்றே boring calendar math: காணாமல் போன ஆண்டை நிரப்புக (current year, date ஒரு மாதத்துக்கும் பழையதாக இருந்தால் மட்டும் next), stated convention-ஆல் named weekday-ஐ date-ஆக மாற்றுக, February 30 போன்ற impossible தேதிகளை inconsistent reads-ஆக reject செய்க. Year inference-ம் weekday resolution-ம் pinned TODAY-லிருந்து எண்ணும், relative தேதிகள் ஒவ்வொரு run-லும் reproduce ஆக:

def extract_date(document: str, role: str) -> dict:
    return assemble(read_parts(document, role))  # one TypeSafe call, then pure code

Demo set முடிவுகள்

நான்கு சிறு documents மீது ஆறு கேள்விகள் (contract, form, survey, review notice), fixed Thursday அடிப்படையில் resolve. ஆறும் சரி:

கேள்விExpectedGotConfFlags
Agreement effective தேதி2025-01-012025-01-010.97
Agreement expiry தேதி2027-12-312027-12-310.91
Form return deadline2026-08-142026-08-140.95
Kickoff call தேதிnonenone0.46review
Survey close ("today")2026-07-302026-07-300.94
Design review ("next Thursday")2026-08-062026-08-060.92

சுவாரஸ்ய வரி kickoff call – form-இல் குறிப்பிடப்படாத date. Model absolute shape-ஐ month இல்லாமல் தருகிறது, date காலியாக 0.46 confidence-உடன் வருகிறது, hallucinate செய்யாமல் மனிதருக்கு flagged. ஐந்து auto-accept, ஒரு human review: இதுதான் முழு operating point.

இறுதி முடிவு

Jev-இடம் calendar math கேட்க வேண்டாம் – text எந்த boxes-ஐ tick செய்கிறது எனக் கேட்டு, math-ஐ நீங்களே செய்யுங்கள். Closed sets மீது Choices + explicit "not stated" options + weakest-link confidence – தேதிகளுக்கு அப்பால் reusable shape. Full source: TypeSafe date-extraction cookbook; தேதிகள் ஏன் jagged என்ற background Jev 1.13 jaggedness guide-இல்.