Deep Dive into Digital and Data Methods for Chinese Studies · University of Michigan
From Printed Page to Research Data
Building humanities tools with AI agents
Mon 2026-11-16 · 2:00–3:30
Hatcher Gallery Lab 100H + Zoom
Slides: d.pr/muuuQI
KL
Kwok-leong TangDigital China Initiative, Harvard University
→ press Space or →, or swipe, to begin
Before we start
How this was made
An AI agent did the work you will see this afternoon. People planned it and checked it.
An open OCR model read the pages
An agent wrote the small programs for each step and ran the checks
A person checked each step before the next step began
AI also helped to make these slides. Any mistake is mine, not the AI's
Use the tools.Own the result.
This morning, in one slide
When AI gets it wrong, where is the problem?
1The modelIt cannot do the task, even with help.This morning: counting letters, reading backwards.
2The engineeringThe model could do it, but it was not given what it needs.This morning: today's news, a Chinese calendar date.
3The humanWe asked in one short message, asked for too much at once, or did not check.This afternoon.
The model is able. The tools are there.What is left is how we ask.
The third category
The human problem
Here is a book. Make it a database.
One sentence. A strong model with good tools will try. It will hand back something that looks finished. We cannot tell what is right in it.
WHAT WENT WRONG IS THE REQUEST
Too much in one step
Nothing that says what “right” means
No place where a person looks
THE FIXSmall steps, a check on each, and a person at the points that need a scholar.
What the person brings
The key instructions
A model can read, write and follow steps. It does not know your source.
ONLY THE PERSON CAN SAY
What the marks mean. On this page, a small circle begins a new record.
What “right” means. This reign has 221 months, and each must appear once.
What to keep. The manuscript writes 于. Do not change it to 於.
Where to stop and ask. If no rule decides it, show it to me.
These are short sentences.They come from knowing the source, not from knowing AI.
This afternoon
Three kinds of work, one method
OVERVIEW
Agents and skills Two ideas we need, in five minutes
明孝宗實錄 One Ming source, 4,310 pages, from the scan to a website
Two difficult books A 1678 household encyclopedia and a Vietnamese manuscript
Playable Pasts Classroom games made from primary sources
One method How the same way of working becomes a skill
Questions, then office hours at 3:45
NO LAPTOP NEEDEDThis session is a demonstration. Watch, and stop me with questions.
Today is about a way of working,not about one tool or one book.
Part 1 · Agents and skills · chat assistant vs agent
An agent is a loop
Chat assistant: you ask, it answers once. One round.
Agent: you ask, and it works in many rounds. In each round it can read a file, run a tool, look at the result, and decide what to do next. Then it comes back with the answer.
WHY THIS MATTERS FOR RESEARCHEvery round is written down. You can go back and see where each part of the answer came from.
Part 1 · Agents and skills
What is a skill?
A skill is a folder that teaches an agent one task:
cjk-calendar/
├── SKILL.md ← when to use it, and how
├── scripts/ ← code that does the work
└── references/ ← details, read when needed
The agent reads only the short description first. It opens the rest when the task needs it.
The description is plain English:
SKILL.md · DESCRIPTIONConvert between Chinese, Japanese, Korean, and Vietnamese lunisolar calendar dates and Gregorian/Julian dates. Use when the user needs to look up historical East Asian dates, convert era names (年號) like 康熙, 天保, 崇禎 to Western dates, compute sexagenary cycle (干支) day/month/year…
A tool is one action.A skill is a method: when to act, how, and what to check.
Part 2 · 明孝宗實錄 · the source
《明孝宗實錄》: one reign, day by day
The Ming Veritable Records (明實錄) are the court's day-by-day record of each reign. This one covers the 弘治 emperor, 1487 to 1505.
A hand-copied manuscript, printed as photographs in 1966 (Academia Sinica): 4,310 pages, 224 chapters (卷, juan)
No punctuation. Read top to bottom, right to left
A month begins with a header: 成化二十三年九月丁酉朔
A record begins with a circle and, often, a day name (干支): ○戊戌. It is one of 60 names, not a number
The goal: a table with one row for each record,and a Western date on every row.
明孝宗實錄 卷二, first page (1966 ed., p. 0009) · for workshop use only
Two open OCR models, both running on our own Mac mini. The same 30 pages, spread through the book. Each page is compared with the old typed text.
Model
Median difference
Better page
Chandra OCR 2
6.6%
25 of 27
Surya 2.5
10.6%
2 of 27
These are the models the local-ocr skill installs and runs.
THE FULL RUN · CHANDRA4,310 pages in 43 hours, about 36 seconds a page, as the test forecast. Nothing left our office. No fee per page.
6 PAGES WENT WRONGOn six pages the model got stuck and repeated itself (a “loop”): a memorial that repeats 敬天, and lists of princes' names that all look alike. We read those pages again in halves.
Part 2 · Step 2 · check the check
The first score said 15% wrong. It was not.
We looked at what the “errors” were. Three things made the number too high:
The margin was counted as text. Every page has a printed label (明孝宗實錄 卷二) that is not in the old text. → 11.2%
Variant characters were counted as errors. The model read 于 correctly; the old text has 於. → 10.6%
The old text was the wrong one on the hardest pages.
WHAT 6% MEANSIt is an upper limit. Some of the remaining differences are the model's mistakes (論 for 諭, 泰 for 秦). Some are the old text's.
A number from a check is also a result.Look at ten examples before you believe it.
4,947 full stopsThe manuscript has no punctuation. On 293 pages the model punctuated the text by itself. On 356 pages it wrote 。 where the page has the record circle ○.
A table of numbersOne blank, speckled page came back as a table full of numbers. The model invented it.
Three forms of one circleThe same hand-drawn circle came back as ○, as 〇 (which is also the numeral zero) and as △.
HOW WE FOUND ITWe counted the record circles on every page. Our text had about 2,000 fewer than the old text. The missing circles were hiding as full stops.
Nobody read 4,310 pages to find this.One count, on every page, found it.
We know things about this book before we read it. Each one is a check.
What we know
The check
Result
224 chapters, numbered
Titles must count 1, 2, 3 … 224
224 found
The reign has 221 months
Each month header must appear once, in calendar order
221 found
A record starts with ○
Count the circles
13,155 records
ONE CHARACTER, A HUNDRED CHAPTERSChapter 13 opens with 弘治元年四月. The model read 弘治九年四月: year 9, not year 1. Our first rule then refused every later header as “too early”, for a hundred chapters.
THE FIXTie the headers to the calendar's own list of months. A header that fits the order, except for one misread character, is accepted with a note.
Part 2 · Step 6 · dates · the cjk-calendar skill
Every record gets a Western date
THE SKILLcjk-calendar holds a table of every month of every East Asian reign, with its first day. A script looks the month up. The model does not calculate dates.
A FREE CHECKThe header names the first day. The table names it too. They must agree: 218 of 218 do.
Dates here are Gregorian, also before 1582. Many reference books give Julian dates for these years: 9 or 10 days earlier.
Part 2 · Step 6 · dates · misread day names
The calendar also corrects the reading. Not always rightly.
THE RULEThree records in a row read 丁卯, 戊戌, 己巳. Days only move forward, and 戊戌 is not between the other two. The one empty day between them is 戊辰: one character different. 46 days were corrected this way. The original reading is kept beside each one.
13,551of 13,552 records dated
46misread days corrected
ONE CORRECTION WAS WRONGWe found it while drawing the page figure. The page reads ○以大祀. The model read 以 as 戊午, and the rule “corrected” it to 戊申, an empty day. That record now has a day it should not have. 18 of the 46 corrections still need a look at the page.
A rule that repairs can also be wrong.Keep the original reading beside every correction.
Part 2 · Step 6 · dates · lost record breaks
The calendar finds lost record breaks
BY RULE395 breaks restored. On 346 of those days the old typed text has a record too.
BY THE HISTORIAN3 unclear cases went to review. One reads 上以戊申紀元: 戊申 is a year there, not a day.
A lost break before a record with no day name leaves no trace. Only proofreading finds it.
Part 2 · Step 6 · dates · the whole reign at once
All 6,526 days of the reign
The historian asked for every day, with the number of records on it. Most empty days are real. An empty day between two full ones is where to look for a lost break.
Part 2 · Step 6 · what the date check found
A date check finds more than date errors
Thirteen day names did not fit the calendar by any rule. We looked at each one on the page image.
What it was
How many
Whose mistake
Pages scanned in the wrong order
2 days, 3 pages
The scan. The printed page numbers run 0470, 0469, 0468. The dates were right; the pages were not
Ordinary words read as day names
6
The OCR model. It made 命成, 內閣, 茂陵 look like day names
A real day, misread in both characters
1
The OCR model. Corrected from the page
A real day, the same day the record already had
1
Nobody's. One character was misread (戊子 for 戊午); the date was right
Days out of order in the manuscript itself
3
The Ming copyist. The old typed text reads the same
We asked “is the date right?”The answer showed a scanning fault, six misread words, and three slips by the Ming copyist.
Part 2 · Step 7 · the historian in the loop · the human-eval-review skill
The first run left 116 cases that the rules could not decide. human-eval-review made them into one web page of cards.
The historian read the cards and saw patterns. Each pattern became a new rule: “if this day name is the day right after the last record, it starts a new record.”
116 → 87 → 64 → 5 cards. The historian answered those five from the page images. The answers are saved as a file and applied by script.
The historian did not check 13,552 records.The historian wrote the rules, and judged the five cases no rule could.
Reads each record. Lists the people and places, as written
A script
Checks that every name stands in its record
A script
Looks the names up: people in CBDB (China Biographical Database), places in TGAZ (China Historical GIS)
Rules
Choose among people of the same name, by date and by office
The historian
Judges a sample of the links
Tested on 200 records first, then run on all 13,552. The model never sees the databases.
THE KEY INSTRUCTION · FROM THE PROMPTCopy each string exactly as it stands in the record, character for character. Never normalise, correct, complete or translate.
THE CHECK63,985 names came back. A script looked for each one in its record. Not one was missing.
The model reads. The script looks up.So the model never writes an ID from memory.
Part 2 · Step 9 · people and places · what the links are worth
“Linked” does not mean “right”
ONE RECORD · 002-0004 · 1487-10-01
In the record
What the script found
Result
英國公張懋
CBDB has 12 people named 張懋. One has dates that fit (1441–1515). Six have no dates
linked, weak
保國公朱永
4 people. CBDB says one was 保國公, and the record names that office
linked, medium
駙馬都尉周景
13 people. Two were alive in 1487. Nothing decides
no link; all are kept
兩廣雲貴川
貴 is short for 貴州. The rule tried 貴縣, a county in Guangxi
linked, and wrong
Not in CBDB: misread names (揚士奇 for 楊士奇), eunuchs, foreigners, princes. Not in TGAZ: frontier names like 遼東 and 宣府.
THE WHOLE REIGN
People
Places
Names found
38,227
25,758
Linked to an ID
12,750
14,313
Not in the database
11,066
11,374
Several candidates, none chosen
5,630
71
In the database, but nobody fits the date
2,608
—
Not looked up: titles, 氏, one-character names
6,173
—
NOT REVIEWED YETNobody has checked these links. Each one shows the rule that made it, and how sure the rule is. What the model missed is not measured.
Record 002-0004. Dotted line: a weak link. Dashed: medium. Grey: found, no ID.
Browse by month or by chapter, or search the text
Click a name: its ID, the rule that made the link, and how sure the rule is
Pages: all 4,310 pages as read, with the model's raw answer
How it was made: each step with its rule, numbers, code and mistakes
Downloads: the table, and every candidate the script looked at
A DRAFT, AND IT SAYS SOEvery page carries the line: machine-read, not proofread, links not reviewed. Search engines are asked not to list it yet.
Part 2 · What it took · 9 to 14 November 2026
Six days: time and cost
What ran
Time
Paid
Step 1 · PDF to 4,310 page images
9 minutes
nothing
Step 2 · OCR on one Mac mini, the full run
43.1 hours
nothing
Steps 3 to 8 · the scripts, one clean run
3 minutes
nothing
Step 9 · Codex reads 13,552 records
2.4 hours
$96 list price *
Step 9 · scripts look the names up
a few minutes
nothing
All machine time
46.5 hours
* Codex ran on a subscription, so nothing was paid per token. $96 is what the same tokens cost at OpenAI's list price on 14 November 2026. Not counted: the AI agent that wrote the scripts with the historian, and the many runs before the clean one.
93%of the machine time is OCR
0.7¢a record, to find the names
THE HISTORIANA few hours of attention, over five working days. The log shows about 3.3 hours of talk with the agent. This number is rough.
The machine hours ran unattended.The historian's hours are where the rules came from.
Part 2 · Looking back · the three categories again
What went wrong, and what fixed it
What went wrong
Model, engineering or human?
What fixed it
Princes' name lists made the OCR model loop
model
Read half a page at a time; try the other model; a person checks these pages
Full stops and a table that are not on the page
model
A count on every page, then a cleaning rule
“15% wrong” when it was about 6%
engineering how we measured
Look at examples; leave out margins; treat variant characters as equal
One misread year stopped a hundred chapters
engineering our first rule
Tie the month headers to the calendar table
趙氏, “a woman of the Zhao family”, was linked to one person in CBDB
engineering our lookup rule
A surname with 氏 is no longer looked up
劉健, a grand secretary, got no link: many people share the name
engineering our rule
A new rule: use the office he holds in other records. 895 more links
116 cases that no rule could decide
human not yet said clearly
The historian turned patterns into rules, and judged the last 5
None of these was fixed by a “smarter” prompt.Each was fixed by a check, a tool, or a rule written down by someone who knows the source.
Part 2 · Looking back · the key instructions in this case
What the historian told the agent
A month begins with a header that names its first day: 弘治十年正月癸卯朔
A record begins with a small circle ○, often with a day name. Days only move forward
The book has 224 chapters. The reign has 221 months. Count them
Use the old typed text only to check, never to fill in
Keep the original beside every correction
What no rule can decide, show to me with the page image
People and places only, no offices. Use CBDB and TGAZ, nothing else
Choose among people of the same name, and record every candidate
Eight sentences.The agent turned them into ten steps and their checks.
NOTICENot one of them is about AI. Each is something a reader of 實錄 already knows.
Part 3 · Two difficult books · kwokleongtang.net/collections/ocr/
Pages harder than the 實錄
The 實錄 page is one column after another. Many books are not. Ordinary OCR reads them badly, or reads the columns in the wrong order.
THE SAME METHOD, WITH VISION MODELS
Two models read every page, each on its own: Claude Opus and Codex
The check: where the two disagree, the place is shaded
The person looks at the shaded places first, with the page image beside the text
Two readings that disagreetell you where to look.
WHAT THESE EDITIONS AREMachine transcriptions. The differences are shown, not settled. Nobody has proofread them yet.
Part 3 · Case 1 · a Fujian household encyclopedia, 1678
增廣幼學須知鰲頭雜字大全
Page image and text side by side. Shaded: the second model read it differently. Images: Harvard-Yenching Library.
WHY IT IS HARD
Several texts run side by side, in an upper and a lower register
Pictures with one-character labels, tables, a star chart and a map
About 47,500 characters in 30 texts
THE KEY INSTRUCTIONThe page is not one text. Find each register, say what kind of block it is, and follow each text across the pages.
THE CHECKOn this opening the second model read 37 places differently.
Part 3 · Case 2 · a manuscript on Vietnamese customs
安南風俗冊 An Nam phong tục sách
By 段展 Đoàn Triển. Hán-Việt readings stand beside the characters. Wavy line: the model was not sure.
WHY IT IS HARD
A semi-cursive hand, in Hán script
Photographs of the manuscript, printed in a modern book
A reader of Chinese may not know the Vietnamese readings
THE KEY INSTRUCTIONRead only what is written. Mark what you are not sure of. Give the Hán-Việt reading for each character.
THE CHECKOn this page the second model read 40 places differently.
Part 3 · Choosing a way to read
Three ways to read a page
Way
Good for
Where the page goes
Cost
An open OCR model on your own computer local-ocr skill: Chandra, Surya
Whole books with a regular page, like the 實錄. Unpublished or licensed material
It stays on your computer
Time: 43 hours for 4,310 pages
Two big vision models multi-agent-vision-ocr skill
The hardest pages: mixed layouts, handwriting
To the companies that run the models
Money: a hard book can cost several hundred dollars
A small app, no setup Gaaucau Quick OCR, a Mac app I built
One PDF, today
It stays on your computer
Free
Check the terms before a scan leaves your computer.A library scan or a licensed text may not be yours to send.
Part 4 · The same way of working, for teaching
Playable Pasts: classroom games from primary sources
Play it: kltng.github.io/yuhang-case-web/
The Yang Naiwu Case楊乃武: a real Qing homicide case, 1873 to 1877.
Students play the county magistrate, the family, the commissioner and the Board of Punishments
They pick evidence from the 1877 memorial, the Qing Code and the newspaper Shenbao
One web page. It runs in any browser
HOW IT WAS MADEBy asking an agent in plain language, with the sources in hand.
Part 4 · kltng.github.io/playable-pasts/start/
The game skill asks before it builds
It interviews you: your students, your goal, your sources, your time
It reads your sources and marks every fact: attested, interpretation, assumption, or invention
It builds the smallest version first
You get one web page, a teacher guide and questions for the debrief
You check it with the site's checker
THE KEY INSTRUCTIONSHere the skill asks for them. The teacher says what the students should learn, and which sources count.
The same pattern as the 實錄:small steps, a check, and the scholar decides.
Part 5 · One method
Three kinds of work, the same four parts
The person's key instruction
Small steps
The check
What the person decides
明孝宗實錄
What a header, a circle and a day name mean
Ten, from images to a website
Counts, the calendar, the old typed text; every name must stand in its record
The last 5 cases. Next: a sample of the links
Two difficult books
How the page is laid out; what to mark as unsure
Blocks, then reading, then readings above the characters
A second model reads the same page
Every shaded place, when proofreading
Playable Pasts
What the students should learn; which sources count
Interview, source notes, smallest game first
Each fact marked: attested or invented
Whether the game is true to the sources
Write these four parts down once,and you have a skill.
Part 5 · From your own way of working to your own skill
A skill is your method, written down
Every scholar and every librarian has steps they repeat: how to check a date, where to look up a person, how to describe an edition. That is a method. A skill is the same method, written so an agent can follow it.
START WITH THREE LINES
Name: what the skill is called
When to use it: one sentence
What it does: the steps a careful person would follow, and what to check at the end
THE SKILLS BEHIND TODAYlocal-ocr · cjk-calendar · human-eval-review · multi-agent-vision-ocr · the Playable Pasts game skill. Each began as steps I repeated by hand.
Do not copy my ten steps.Ask: what are the steps, and the checks, in my own work?
Part 5 · Being honest about it
Where this breaks down
Pages no model can read yet. Poor handwriting, damaged prints
Nothing to check against. With no second text and no table, a person must read
Time and money. 46 hours of computer time for one reign, and about $96 of tokens at list price
A right database, a wrong match. CBDB has 12 people named 張懋
Rights. Check the terms before a scan or a licensed text goes to a cloud service
A check lowers the risk.It does not remove the reader.
Summing up
Three questions for any AI result
1Where did it come from?The scan, a database, or the model's memory?
2Can I check it?Is there a page, a line, a database ID?
3Who decided?A rule, the agent, or a person?
3:45 PM
Office hours, here. Bring your own source or project
Tue 10:00
Agentic Search for Libraries, for library staff: catalogs, and how a library opens its collections to agents
From Printed Page to Research Data · University of Michigan · thank you
Questions?
Now, at office hours at 3:45, or by email after today.