New Tool Radar

OCR & Text Layers

How to Give Tesseract a User Words List for a Scanned PDF

Add your document's unusual words to Tesseract's user-words list so names and terms OCR recognises are spelled your way.

Schematic illustration of a Tesseract user-words list: without it the surname Harveson is misread, with it the surname is spelled correctly three times.

Tesseract’s manual describes –user-words as a file listing words Tesseract should consider while recognising, in addition to its own dictionary. That is the fix for a surname, a place name or a product term the dictionary does not know.

Use the practice file

A practice document, practice-user-words.pdf. The file is fictional.

Page Content
1 Report mentioning the surname “Harveson” 3 times
2 Report mentioning the place name “Millford” twice
3 Notes, no unusual words

Page 1 is the check page: the surname “Harveson” appears there 3 times.

Check the user-words list

Expected result. We checked the OCRmyPDF manual and the Tesseract manual. We did not run any tool. The checks below are what to expect if the work is done correctly; run them yourself on the practice file.

1. Run OCR without the list

Run Tesseract on page 1 with the default dictionary.

Expected result: Note how “Harveson” comes out — a dictionary word may replace it.

2. Write the user-words file

Create a text file with one word per line: Harveson and Millford.

Expected result: The file holds exactly the two words, one per line.

3. Run OCR with the list

Run Tesseract with –user-words words.txt on page 1.

Expected result: Tesseract produces a new text file.

4. Compare the surname

Search both outputs for “Harveson”.

Expected result: The run with the list spells “Harveson” correctly 3 times; the run without it does not.

Verdict table

Check Expected result Pass?
Run OCR without the list Note how “Harveson” comes out — a dictionary word may replace it. —
Write the user-words file The file holds exactly the two words, one per line. —
Run OCR with the list Tesseract produces a new text file. —
Compare the surname The run with the list spells “Harveson” correctly 3 times; the run without it does not. —

Related guides: How to Batch OCR a Multi-Page PDF with Consistent Settings — How to Add a Searchable Text Layer to a Scanned PDF.

Limits

  • A user-words list only helps if the words are spelled exactly as printed; a typo in the list teaches Tesseract the typo.
  • Command-line OCR rewrites the file, so always work on a copy and keep the original scan untouched.
  • UNTESTED — no OCR tool was run; all results above are expected results. The practice file is fictional.

Sources

See all