4

I'm trying to use tesseract's user-patterns with pytesseract but can't seem to get the command working. This seems like it should be fairly straight forward but the documentation is sparse

I'm on tesseract 3.05.01. Doing this doesn't work:

pytesseract.image_to_string(image, config='--oem 0 bazaar --user-patterns ./timestamps.user_patterns')

I have a bazaar file in /usr/local/share/tessdata/configs/bazaar that says this:

load_system_dawg     T
load_freq_dawg       T
user_words_suffix    user-words
user_patterns_suffix user-patterns

I'm trying to detect 4 numbers, so my user patterns file is:

\d\d\d\d

The error I get is:

pytesseract.pytesseract.TesseractError: (1, "read_params_file: Can't open -user-patterns read_params_file: parameter not found: \\d\\d\\d\\d")
Thariq Shihipar
  • 1,072
  • 1
  • 12
  • 27
  • 1
    Remove your `--user-patterns ./timestamps.user_patterns` param from command. Tesseract will find your user-patterns from your bazar config. Note that with naming you have chosen - you are expected to use `timestamps` language (and same traineddata file). Also, notice that it is very unlikely that patterns file will do what you expect it to do & it is probably easier to add some postprocessing step instead. – Dmitrii Z. Jun 14 '18 at 06:31

0 Answers0