Module SICAR.drivers.paddle
PaddleOCR Driver Module.
This module provides an implementation of the Captcha driver using PaddleOCR. The Paddle driver utilizes PaddleOCR to extract text from captcha images.
Note
This driver requires the paddlepaddle and paddleocr libraries to be installed.
Classes
Paddle: Implementation of the Captcha driver using PaddleOCR.
Classes
class Paddle
-
Implementation of the Captcha driver using PaddleOCR.
This driver utializes PaddleOCR to extract text from captcha images.
Note
This driver requires the paddlepaddle and paddleocr libraries to be installed.
Initialize the PaddleOCR instance.
Note
The
use_angle_cls
parameter is set to False to disable text angle detection. Thelang
parameter is set to "en" to specify the English language. Theuse_space_char
parameter is set to False to disable space character output. Theshow_log
parameter is set to False to suppress PaddleOCR's logging messages.Ancestors
- Captcha
- abc.ABC
Methods
def get_captcha(self, captcha:
) ‑> str -
Extract text from the provided captcha image.
Parameters
captcha (Image): The captcha image.
Returns
str
- The extracted text from the captcha.
Note
This method processes the captcha image, improves its quality, and uses PaddleOCR's ocr method to perform optical character recognition. The extracted text is then cleaned using regular expressions to remove non-alphanumeric characters.