Commit

7a9a9e9

Data architecture. All offline scripts writing files into data/; the site is static Astro and reads only events.json at build time (titles, grouped by number). The PDF/text/mentions/citations steps are done but not wired in yet; step 8 connects them.
Hmm, can't we normalize them into a single list of events? Some PDF we can create event from title alone, others we need to extract from text. ykwim?
Yes, makes sense: one route_events list, one row per (notice, route), source = text when we have it, title otherwise, plus page/quote and the notice it amends. The site then reads only that. Doing it.
Done. One list now: data/route_events.json, 7,525 rows, one per (notice, route). 4,272 from PDF text (badge "เนื้อหา", with quote + link to PDF page), the rest from titles. 2,119 know which notice they amend. The site reads only this file.
Now I wonder how many notices were we able to extract the events from. Maybe you can visualize it as a funnel where: 1. The event is evident in the title. That's the first item in the funnel. 2. The ones that have the text layer in the body. That's the second one that we are able…
Funnel: 7,334 notices. Title gives the route for 4,201 (57%), text layer for 410 more (6%). 2,723 left: 2,440 are 1955–2001 scans (the real transcription job), 255 have text my parser missed (fixable), 28 have no PDF link.
I think we should OCR them. Thinking about https://paxalabs.com/ocr, which based on my https://github.com/dtinth/34bench benchmark, works very well, and most importantly, is deterministic. I want to do it in a way that allows us to contribute back to the openlawdatathailand…
Paxa LabsMultilingual OCR API: PDFs and Images to Text and FieldsPaxa OCR Lite reads Thai, English, Chinese, and other documents into Markdown or layout blocks. Paxa Document Extraction fills a schema of typed fields.
Two notes: Paxa's docs don't claim determinism, and the changelog shows paxa-ocr-lite-v1 changing behavior on Oct 30 under the same id, so I'd record the date per row. Also their openlawdata-ocr rows say method "redecode": they already fixed the garbled 2002–04 fonts. Which…
re. determinism - I have tested it in 34bench. All runs return same result. So they didn't claim it but I tested it. re. PAXA_API_KEY - make a template file with placeholders please. btw, if you had a lot to say that would require multiple posts, you should make an infographic…
Thanks, good to know you tested determinism. Done: .env.example has PAXA_API_KEY=pxa_REPLACE_ME (.env is git-ignored). Infographic rule saved. About 2.7k of 5k old PDFs are downloaded; when the rest are in I'll post one infographic with exact pages and ฿ per scope.
OCR pilot: 45.5 credits so far. Thai text is great, but Thai digits are not. Route and notice numbers were wrong in 3 of 5 scans. Paused here. I can do the free fixes now: metadata cross-check and parser. OK to spend ~50 credits testing upscaled images for the digits?
I'd try Typhoon OCR first (Thai-tuned, cheap), then iApp (already the dataset's 2011+ source) and Gemini Flash. Let's test digits, not trust benchmarks: I verified 5 pilot scans by eye, so I'll score each provider on those. Which keys can you add to .env?
Done. .env now has TYPHOON_API_KEY, IAPP_API_KEY and OPENROUTER_API_KEY set to REPLACE_ME, each with a comment and link. .env.example has the same lines. Your Paxa key is untouched. Fill in any of them, tell me which, and I'll run the digit test.
Bench on the 5 pilot scans: Typhoon got 37/37 key numbers, Gemini Flash 36, iApp 35, Paxa 25. I suggest Typhoon as the main pass, with Gemini as a second opinion on numbers. Correction: the 1975 route is ๔๒๖๙, not ๔๒๖๘. Go ahead on the 2.4k stuck notices?