J•JEV Field Guide
Home/Jev date and candidate extraction: roles before normalization

After the basics · Worked guides

Jev date and candidate extraction: roles before normalization

Select spans from an email with several dates and amounts, then handle locale, reference time, and missing values in code.

Source checked 2026-10-0218 minutes
What you will build

Copy target values from the source while retaining roles, spans, and normalization context.

Before you start · How to design Jev state: from raw text to usable facts

Design it step by step

01

Define roles before finding numbers

Invented email: invoice October 3, registration deadline October 8, list price USD 120, discounted price USD 90. Name deadline and payable amount explicitly; first position or largest amount does not establish role.

02

Extract candidates with spans

Retain IDs, offsets, exact text, and neighboring context. Choice selects a candidate or none. Identical numeric strings at different positions may have different roles; avoid losing span identity.

03

Ask only about semantic roles

The official pre-parsed approach selects from supplied candidates and copies the source value. Identify the stated deadline or payable price. Choose none if absent; do not invent a value or missing year.

04

Provide locale and reference time

03/04 can be ambiguous. Tomorrow requires message time, timezone, and a reference date. This example fixes 2026-10-02, giving October 3 in the local calendar. Preserve ambiguity when context is missing. Use Decimal and explicit currencies.

05

Validate and retain uncertainty

Use calendar libraries to reject impossible dates. Store raw spans alongside normalized values. Correct role selection does not resolve ambiguous formats or authorize payment. Test credits, fees, multiple currencies, and missing years.

Worked example · Invented by this site

ObservationJudgmentApplication action
USD 120 list / USD 90 discountSelect the payable candidateCopy 90 with USD; no payment action
03/04 without localeAmbiguous date orderKeep raw text for review
Tomorrow; reference 2026-10-02Requires a local reference contextResolve October 3 in code

A copyable design draft

Original examples. JSON illustrates request or input structure; Python calculates invented scores without an API call. Verify current interfaces and task policy before integrating.

# Offline date arithmetic with an explicit reference date.
from datetime import date, timedelta
reference = date(2026, 10, 2)
print(reference + timedelta(days=1))  # 2026-10-03
# Candidate selection is a separate judgment, not performed here.
# Preserve timezone and source text when handling real messages.
Design a decision

Common mistakes

  1. Selecting the first number or largest amount.
  2. Inventing a missing year or currency.
  3. Dropping original text and span provenance.

TRY / THINK / COMPARE

Think first, then compare

03/04 has high role-selection confidence. Store April 3?

Show explanation

Not yet. Role confidence does not resolve date-order ambiguity. Obtain locale evidence or review.

Before handing it over

  • Roles and none are defined.
  • Candidates retain source spans.
  • Year, timezone, currency, and locale are explicit.
  • Invalid and ambiguous values go to review.

Common questions

Who performs date arithmetic?

Calendar libraries and code; the model reads roles or named parts.

What if the candidate finder misses the target?

Return none and improve retrieval; do not force a wrong selection.

Sources and further reading

Inspired by official patterns and Datawhale practice topics. Explanations, examples, and exercises are independently written. These are teaching designs, not live API runs or benchmarks.