New Tool Radar

AI PDF

How to Add Proper Names to Tesseract So They Are Recognised Correctly

Add proper names to a Tesseract user-words file and re-run OCR to check the names come out right.

Schematic with three steps: Create a user-words file; Run Tesseract with the user words; Check every name in the output.

Proper names are the words a generic dictionary does not contain, so Tesseract often guesses a common word instead: a surname becomes a place name, a company name becomes two ordinary words. A user-words file tells Tesseract the names you expect, so it can choose them when the letters fit.

What you need

  • Tesseract installed
  • A scanned page containing proper names
  • A list of the names as they should be spelled, one per line

Step 1: Create a user-words file

Save the names one per line in a file such as names.txt. The file must be named after the language, for example eng.user-words, and placed where Tesseract can find it.

Step 2: Run Tesseract with the user words

Run tesseract page.png out –user-words names.txt -l eng and read the output. The –user-words option points Tesseract at your list.

Step 3: Check every name in the output

Compare each proper name in the output with your list. If a name is still wrong, check its spelling in the file and the quality of that part of the image.

Worked example: synthetic name check on a meeting attendee list

The table below is a synthetic example. It shows the expected result of adding user words; no OCR was run.

Name on page Without user words With user words
Kowalski Kowalskl Kowalski
Okafor Okafor Okafor
Nguyen Nguyer Nguyen
Van der Berg Vander Berg Van der Berg

Expected result (UNTESTED). without user words 2 of 4 names are misread (Kowalskl and Nguyer), while with the user-words file all 4 names read correctly. Keep the user-words file with the project so future pages benefit too. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • User words only help when the letters on the page are close to the name; a badly blurred name will still be misread.
  • Adding too many words, or words that are not names, can make ordinary text worse.
  • The user-words file must match the language code used in the run, or Tesseract will not load it.

Sources

See all