Inspiration

Official mail in Japan (tax, health insurance, schools, city offices) is written in dense bureaucratic language that many of the roughly 3.9 million foreign residents cannot read. Machine translation gives them a paragraph, but not the answer to "what must I do, and by when?". I study foreign languages at a Japanese university, and I wanted to see whether a multimodal model could go one step beyond translation and extract the action.

What it does

Who it is for: people living in Japan who cannot read a letter they received, and the Japanese neighbors, coworkers, landlords or teachers who help them.

Main features:

  • Photo or pasted text in, three panels out: plain Japanese (short sentences, simple words, mostly hiragana), a translation into one of eight languages, and at most three actions with deadlines.
  • If the letter gives no deadline, the page shows "No deadline stated" instead of inventing one.
  • Plain Japanese and the reader's language are side by side so two people can check the same screen.
  • Japanese/English interface, and a demo mode that works without an API key.

Check against the original. A fourth panel lists every amount, date, time and phone number in the letter with ✓ (still in the plain Japanese and the to-do list) or ⚠ (missing). A date or an amount that the output has but the letter does not is also marked ⚠, because the model may have invented it. This panel uses no AI: check.js applies fixed rules after normalizing full-width digits and kanji numerals (一万二千五百円, 十二月二十五日, 午後3時). For a photo, Gemini also returns a word-for-word transcription, and the check runs against that.

The AI. Model: gemini-3.5-flash through the Gemini API. Role: it is the whole reading pipeline. It reads the photograph directly (no OCR step), rewrites the text, translates it, and extracts the actions, in one call. The response is constrained by a JSON schema (easy: string, native: string, todo: array of {what, when, note}, original: the word-for-word transcription used by the check panel), so the page can always render it.

Representative input: a municipal notice titled "国民健康保険料 納付のお知らせ" saying the sixth installment of 12,400 yen is due on 15 December, payable at the ward office, a bank or a convenience store with the enclosed slip, with a late-payment warning.

Representative output (English): plain Japanese "12月15日までに 12,400円 をはらいます。" and the actions "Prepare 12,400 yen (by December 15)", "Bring the payment slip from the envelope", "Pay at a bank, convenience store, or ward office". The repository ships this sample as the demo result, also in Simplified Chinese and Vietnamese.

How we built it

The app is one HTML page plus a small rule file (check.js), with no build step and no backend. The browser sends the photo as an inline image plus a Japanese system prompt to the Gemini API with responseMimeType: application/json and a responseSchema. The prompt tells the model to shorten sentences, replace difficult words, translate into the chosen language, limit the to-do list to three items, never add information that is not in the letter, and write "No deadline stated" when no date appears. The user's key is held in session storage of the tab and sent only to Google. The interface strings are a small Japanese/English table; the language of the translation is a prompt parameter, so adding a language is one line in a list.

Pre-existing versus this event: the project was started on 12 November 2026, during the build period, and everything in the repository was written during it. Reused components: none beyond the browser platform and the Gemini API. AI assistance: Claude Code helped write and review the code; the product idea, the prompt and the screen design are mine.

Challenges we ran into

Dependable output was the main issue. Asking for free text makes the page guess where the translation ends and the to-do list begins, so I moved to a response schema. The second issue was hallucinated dates, which are costly in this domain; the prompt forbids inference and gives an explicit phrase for the missing-deadline case. The third was keeping a single file usable by non-technical people, which led to the demo mode and the side-by-side layout.

Limitations and failure cases: translation can be wrong, so amounts and dates should be checked against the original letter, which stays visible on the page. Blurry or handwritten letters may be misread. A letter that spreads one task over several pages needs the pages to be pasted together. The letter is sent to the Gemini API, so documents that may not be shared should not be used. I do not claim an accuracy figure; I have not measured one.

Testing

A wrong deadline or amount is the most expensive mistake this app can make, so the tests target exactly that. tests/letters.json has twelve letters of the kinds people bring to an international-exchange counter (health insurance, resident tax in four installments, a school trip, a pension notice, bulky-garbage pickup, a health check, a garbage-day change), each paired with a model output. Five outputs are wrong on purpose: three tax installments dropped, a rain date dropped, a deadline invented for a letter that has none, 12,400 yen copied as 1,240, a phone number left out. node --test (16 tests) requires the checker to flag exactly those and nothing in the seven correct outputs. A browser test (Playwright) runs the page with the Gemini reply mocked and checks the panel for pasted text, a photo and the demo. Writing the cases set the scope of the rules (real letters use kanji numerals, full-width digits and 午後 times), and they are why the schema gained the original field: without it a photo could not be checked at all.

What the check cannot do: it catches a dropped or changed number, not a wrong meaning ("pay" translated as "you will be paid" passes), and for a photo it compares with Gemini's own transcription, so a digit misread from the photo is not caught. Pasting the text avoids the second problem.

Accomplishments that we're proud of

  • The output answers the user's real question instead of only translating.
  • A schema-constrained single call replaces what would otherwise be OCR, rewriting, translation and extraction stages.
  • A public MIT-licensed repository, no server, and a demo mode that lets reviewers try the page with no key.

What we learned

Constraining a model with a schema and an explicit "do not invent" rule made its output far easier to build a reliable interface around than free-form text. Showing the original-language text next to the simplified version is also a cheap and effective way to make an AI result checkable by a human.

What's next

Furigana and read-aloud, more languages, a way for a city office to add its own local vocabulary, a follow-up question box, and a trial with real letters at an international-exchange counter to measure accuracy honestly.

Built With

Share this project:

Updates

Submission history