Even though it's 3 years later now, the disabling is possible with the -c flag.
pytesseract.image_to_string(roi, lang='eng', *config='*--psm 3 --oem 3* -c load_system_dawg=false -c load_freq_dawg=false -c 0tessedit_char_whitelist=* 0123456789r°:-abcdefghijklmnopqstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ*'*) >From the tesseract.exe -c VAR=VALUE Set value for config variables. Multiple -c arguments are allowed. --psm NUM Specify page segmentation mode. --oem NUM Specify OCR Engine mode. NOTE: These options must occur before any configfile. Page segmentation modes: 0 Orientation and script detection (OSD) only. 1 Automatic page segmentation with OSD. 2 Automatic page segmentation, but no OSD, or OCR. (not implemented) 3 Fully automatic page segmentation, but no OSD. (Default) 4 Assume a single column of text of variable sizes. 5 Assume a single uniform block of vertically aligned text. 6 Assume a single uniform block of text. 7 Treat the image as a single text line. 8 Treat the image as a single word. 9 Treat the image as a single word in a circle. 10 Treat the image as a single character. 11 Sparse text. Find as much text as possible in no particular order. 12 Sparse text with OSD. 13 Raw line. Treat the image as a single text line, bypassing hacks that are Tesseract-specific. OCR Engine modes: 0 Legacy engine only. 1 Neural nets LSTM engine only. 2 Legacy + LSTM engines. 3 Default, based on what is available. ale...@gmail.com schrieb am Mittwoch, 8. Januar 2020 um 13:12:49 UTC+1: > I have the same problem. Any Idea? Creating a new file with these > parameters with False values and passing it (and absolute path) to > pytesseract functions doesn't work!!! > > > El viernes, 11 de octubre de 2019, 10:32:12 (UTC+2), Sandra M. escribió: >> >> I'm trying to deactivate the tesseract dictionary, but I don't get it. >> I'm using tesseract 5.0.0 and use the Python code below. I read about the >> parameters load_system_dawg and load_freq_dawg to change them in the >> config, but I don't know how to do this exactly. Can someone give me more >> details how to do this? >> >> >> import pytesseract >> import argparse >> import cv2 >> import os >> >> # construct the argument parse and parse the arguments >> ap = argparse.ArgumentParser() >> ap.add_argument("-i", "--image", required=True, >> help="path to input image to be OCR'd") >> args = vars(ap.parse_args()) >> >> # load the example image and convert it to grayscale >> image = cv2.imread(args["image"]) >> gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) >> >> # write the grayscale image to disk as a temporary file so we can >> # apply OCR to it >> filename = "{}.png".format(os.getpid()) >> cv2.imwrite(filename, gray) >> >> # load the image as a PIL/Pillow image, apply OCR, and then delete >> # the temporary file >> text = pytesseract.image_to_string(gray, lang='eng', config='--psm 6') >> print("Output: " + text) >> >> >> >> -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/42ff893e-6dcb-4fb8-a52a-53488737c1can%40googlegroups.com.