Ask HN: What is the best method for turning a scanned book as a PDF into text?
41–50 of 122 posts
Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#42There is a lot of enthusiasm around language models for OCR and I have found that generally they work well, however I have had much better results, especially if there are tables etc., by sending the raw page to the llm along with the ocrd page, and asking it transcribe from the image and validate words/character sequences against the ocr.
This largely solves for numbers and things being jumbled or hallucinated.
I recently tested llamaparse after trying it a year prior and was very impressed. You may be able to do your project on the free tier, and it will do a lot of this for you.
Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#43Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#44Copyright issues aside (e.g. if your thing is public domain), the galaxy-brain approach is to upload your raw scanned PDF to the Internet Archive (archive.org), fill in the appropriate metadata, wait about 24 hours for their post-upload format-conversion tasks to run automatically, and then download the size-optimized and OCR-ized PDF from them. I've done this with a few documents from the French and Spanish national…
Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#45Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#46You could script it using Gemini via the API[1].
Or use Tesseract[2].
Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#47For OP, there is a library written in rust that can do exactly what you need with very high accuracy and performant [1].
Would need to OCR dependencies to get it to work on scanned books [2].
[1] https://github.com/yobix-ai/extractous
[2] https://github.com/yobix-ai/extractous?tab=readme-ov-file#-s...
Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#48I did this very recently for a 19th century book in German with occasionally some Greek. The method that produces the highest level of accuracy I've found is to use ImageMagick to extract each page as a image, then send each image file to Claude Sonnet (encoded as base64) with a simple user prompt like "Transcribe the complete text from this image verbatim with no additional commentary or explanations". The whole thi…
Is it really necessary to split it into pages? Not so bad if you automate it I suppose, but aren't there models that will accept a large PDF directly (I know Sonnet has a 32MB limit)?
Re: Ask HN: What is the best method for turning a scanned book as a PDF into text?
#49Seeing blind recommendations for AI slop is very disappointing for HN. For OP, there is a library written in rust that can do exactly what you need with very high accuracy and performant [1]. Would need to OCR dependencies to get it to work on scanned books [2]. [1] https://github.com/yobix-ai/extractous [2] https://github.com/yobix-ai/extractous?tab=readme-ov-file#-s...
I especially like the approach to graalify Tika.