Documentation
¶
Overview ¶
Package ocr provides a wrapper around system commands to facilitate Optical Character Recognition (OCR) via command-line tools like Tesseract. It abstracts command execution and output handling, allowing for easy mocking and testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
Command is an interface that abstracts functionalities for sending text input to a command and receiving text output. This abstraction aids in executing and processing the output of system commands.
type Ocr ¶
type Ocr interface { // TextFromImageFile executes the OCR process on the specified image file and returns the extracted text. // It returns any errors encountered during the OCR operation. TextFromImageFile(fileName string) (string, error) }
Ocr interface abstracts the OCR operations. It provides a function to extract text from image files.
type Option ¶
type Option func(*ocr)
Option is a function type that applies a configuration to an ocr instance. It's used for optional configuration of the OCR process, allowing for flexible customization of the ocr struct's behavior.
func TesseractPath ¶
TesseractPath returns an Option that sets the path to the Tesseract executable. This function allows users of the ocr package to specify a custom path for the Tesseract binary, overriding the default path.
Parameters:
path - The file system path to the Tesseract executable.
Returns:
An Option function that, when applied to an ocr instance, sets its binary path.