The Need: a book you want to search, but it is only paper
I have a 19th-century commentary on the five books of Moses. It has six volumes. I wanted all of it inside my own search tool, so I could ask a question in Korean and get the commentary back as one of the sources.
The usual way is to scan the pages and turn them into text. That worked badly for me, and the way it worked badly led to the cheaper answer.
The Proof: six books, one small bill
| Item | Number |
|---|---|
| Volumes translated | 6 (Genesis, Exodus, Leviticus, Numbers, Deuteronomy I and II) |
| English text | about 3.7 million characters |
| Paragraphs sent to the model | about 4,460 |
| Wall-clock time for the last five | under 50 minutes (run in parallel) |
| Billed by the API for all six | about $1.20 |
Per-volume numbers for the five I ran last:
| Volume | Paragraphs | Time | Flags left after my fixes |
|---|---|---|---|
| Genesis | 523 | 30 min | 12 |
| Leviticus | 560 | 34 min | 7 |
| Numbers | 898 | 46 min | 15 |
| Deuteronomy I | 878 | 42 min | 23 |
| Deuteronomy II | 1,001 | 49 min | 9 |
“Flags” means paragraphs my checker marked as suspicious. Most of them are false alarms, and I explain why below.
After the translation I added the six books to my local search as sources. When I ask about the bronze serpent and Christ, the Numbers commentary now comes back next to my other sources. That made me happy. I have not measured how good the answers are. I only know that the books are found.
The Story: from a craft knife to a library
The scan plan. To scan a thick book on a duplex (two-sided) scanner, you cut off the glued spine. For the first volume, Numbers, I did it myself with a craft knife. It was hard work. For the other five, I paid a bookbinding shop: 1,000 won for one book, 5,000 won for five. That is roughly $3.50 in total, by my rough exchange rate. I had the cut books ready to scan.
The scan was not good enough. I scanned Numbers, transcribed it, and added it to my search. Search did not work well. The text had broken spaces and wrong characters. To read it again more carefully, I tested a vision model on my own GPU server. It took about 46 to 80 seconds per page, and about 7 hours for one book. A cloud chatbot would be faster, but it costs money. For six books, I was choosing between waiting days and paying an unknown bill.
💬 Prompt that worked “What about translating it into Korean with qwen2.5 to raise the quality? I will have to translate many books into Korean later, so shouldn’t we set this up?”
Then I looked in the library. I had just finished a six-day download of a public-domain library (I wrote about it here). On a hunch, I checked whether this commentary was in it. All six volumes were there, in English.
So the job changed. I no longer needed to read paper. I needed to translate clean English text into Korean. The five cut books stay on the shelf, unscanned. The 5,000 won did not buy me anything I use now.
Local Qwen first, because it is free. I tested ten paragraphs of Exodus on a 32B and a 72B Qwen2.5 model. I did not like the results:
| Qwen2.5 32B | Qwen2.5 72B | DeepSeek API | |
|---|---|---|---|
| 10 paragraphs | about 190 s | 628 s | 25 s |
| Paragraphs that slipped into Chinese | 3 of 10 | 1 of 10 | 0 |
| Estimated time for Exodus | about 5 hours | much longer | 33 min (measured) |
Three kinds of problems showed up:
- Chinese leaks into the Korean. Single Chinese characters, whole sentences in Chinese, and a note like “(注: …)” in the middle of the text. The checker caught them, and I added a retry at a higher temperature. Some paragraphs, often poetry quotes, kept failing. I did not measure again how much the retry helps Qwen after I fixed the retry code, so I cannot say it is hopeless.
- Wrong meaning. In the pilot, a sentence about one man’s wife was turned into the king’s wife, and “providence” became a word that means “management”.
- Wrong verse numbers. A short note like “(Ver. 8-10.)” was turned into a different Bible book by the 72B model. The model does not know which chapter we are in.
At 190 seconds per ten paragraphs, the five books of Moses would take about 30 hours or more. I could live with the wait. I could not live with the Chinese leaks.
DeepSeek translated the same ten paragraphs in 25 seconds with no flags. Names and terms were right. I asked for 100 paragraphs next:
💬 Prompt that worked “Please translate 100 paragraphs of Exodus with DeepSeek.”
Exodus (604 paragraphs) took about 33 minutes. The tests, two re-runs of 100 paragraphs, and the full book came to a $0.20 charge. Then I asked for the other five in one go, and they ran at the same time.
The How: the translation pipeline
The tool is one Python file. It reads the English text, splits it into paragraphs, and sends one paragraph at a time.
python translate_book.py <book-id> --model deepseek-chat \
--start 0 --limit 99999 --book <short-name>
What the script does around the model
- Cleans the text. It removes the library header, the table of contents, and old-format footers. Starting from the first “CHAPTER I.” line avoids the contents page.
- Fixes verse references before the model sees them. A regular expression turns
Rom. iii. 25into롬 3:25. The model is told to leave these alone, so it cannot invent a verse. - Tracks the chapter. A bare
(Ver. 8-10.)becomes(출 1:8-10), using the last chapter heading it has seen. This is what the 72B model got wrong. - Uses a glossary. A few dozen terms are fixed, such as burnt-offering, meat-offering, tabernacle, and the Korean forms of names. The system prompt also bans Chinese characters, Cyrillic, and any “translator’s notes”.
- Gives the previous paragraph’s translation as context. It is marked “do not translate again”.
- Checks every answer. A paragraph is suspicious if the Korean is under 0.35 or over 1.3 times the English length, if there is too much Latin text left, if any Chinese, Japanese, Cyrillic or Arabic letters appear, or if a
12:3-style reference is missing. It then retries up to two times at a higher temperature. - Caches by hash. Results go into SQLite, keyed by paragraph text, model and prompt version. If the job stops, running it again continues where it stopped. It also lets me fix one paragraph by hand and regenerate the output files for free.
🗂 Claude.md Rule Never send a line with no letters in it to the model. A separator like
* * * * *was “translated” into an invented paragraph that introduced the next book. Lines without Latin letters are copied as they are.
🗂 Claude.md Rule After a bulk translation, always list the “foreign script” flags. Retries did not remove every Chinese leak. Four paragraphs were left (three in Leviticus, one in Deuteronomy II), even with “no Chinese characters” in the prompt.
Running five books at once
I started five processes. They share one SQLite cache, so I raised the connection timeout:
sqlite3.connect(os.path.join(OUT, "cache.sqlite"), timeout=120)
There were no lock errors. The API did not slow down visibly, and the slowest volume (Deuteronomy II, 1,001 paragraphs) took 49 minutes.
Cleaning up what the checker found
Among about 3,860 paragraphs in the five books, only four had foreign characters left. Two were fixed by asking again with “Chinese is forbidden” added. For the other two, retrying five times did not help, and the damage was small, so I edited the cached answer directly:
- one case of a Chinese character in brackets after a Korean word, which I removed;
- one sentence where a Chinese phrase sat inside a Korean sentence, which I replaced with the Korean word.
The remaining flags I looked at by eye. Almost all were false alarms: a heading “FOOTNOTES:” is short in Korean, [Illustration] is short, and a verse reference that the model wrote out in words (“Luke 14:26” became “누가복음 14장 26절”) fails the regular check.
Cost
- DeepSeek API: about $1.20 for all six volumes, including the first tests and re-runs (as shown on the billing page).
- Local GPU server: a borrowed machine, $0 for the Qwen tests.
- The bindery: 5,000 won (about $3.50), and not needed in the end.
- Claude subscription: not counted here.
What I do not know yet
- Bible quotations. The commentary quotes a lot of Scripture. The model translates the quotes in its own words. I have not yet replaced them with a standard Korean Bible text.
- A different book. The Korean volume I scanned was a published translation. My new source is an AI translation of the English original. The wording will not match the book on my shelf, and I replaced my old Numbers scan with the new text.
- Two long Bible quotes (one in Numbers, one in Deuteronomy II) came out much shorter than the English. They may have lost words. I have not compared them line by line yet. In one Deuteronomy I paragraph, the model also dropped the verse references in brackets.
- The $1.20 figure is the billed total. I did not split it by volume.
The next step is reading a few chapters side by side with the English, and then deciding whether the Bible quotes need replacing.