Skip to main content
A newsroom gets 1,400 scanned pages in 9 files after a records request: minutes, invoices, letters, some with stamps across the text. A reporter needs every page that names one contractor before the story runs on Friday. A plain search of recognized text finds 11 pages and gives no sign of the pages on which the name was read wrongly. This page builds a search of scans in which each place has its page, its confidence, and a picture to check it against.

The run in 4 steps

Upload each file as a job

Send each file once. A long scan is read as a job, page by page, and the record follows when the job is done. A scan has no headings, so its outline has one row for each page.

Search every record for the names

Send the names against each record as strings to find. One call takes 5 strings, so send the name as the records can spell it: in full, in its short form, and the surname of its director. The last string here is a question.
Request body of highlight_contents
Replace the 4 placeholders with the names and the number as the records can have them. A name is matched word for word, and a difference in upper and lower case is passed over. The question is given to a model, which picks the passages that bear on it.

Read each place with its confidence

Each place comes with its page and with a number from 0 to 1 for how sure the recognition of those words was. These 2 places are from one file, cut to the fields that this step explains.
Part of the response
The name on page 212 was read with a confidence of 0.97. The contract number on page 388 was read with 0.64, so the reporter looks at that page before it is quoted.

Check a page against its picture

Each scanned page comes with a picture of it, for as long as the record is stored. The reporter opens the picture of page 388 beside the recognized words, and the story quotes what the paper says. A page that was recognized with a low confidence as a whole is named in a notice. Those pages are the ones on which a name can be present and not found, and a person reads them.

What the editor can check

Know the limits

A match does not pass over an error of the recognition. A name that was read as another word is not found, which is why the pages with a low confidence go to a person. Handwriting comes as flat text or not at all, and no notice says so. A blacked-out part of a page is not reported as such. A file can have at most 100 MiB. A record is stored for 48 hours after its last use and for at most 30 days, so download the pictures of the pages that the story rests on. For the calls, see Turn PDFs, Office files, and scans into evidence you can cite by page and Highlight the evidence for each question.