Documentation
¶
Index ¶
- func CleanProviderResponse(content string) string
- func ConvertToBasicHOCR(response OCRResponse) string
- func CreateTextImage(text, tempDir, filename string) (string, error)
- func ExtractWordImage(imagePath string, bbox BoundingPoly, tempDir string, wordIndex int) (string, error)
- func TranscribeWordsIndividually(imagePath string, response OCRResponse, provider providers.Provider, ...) (string, error)
- func WrapInHOCRDocument(content string) string
- type Block
- type BoundingPoly
- type FullTextAnnotation
- type LineBox
- type OCRResponse
- type Page
- type Paragraph
- type Response
- type Symbol
- type Vertex
- type Word
- type WordBox
- type WordImage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanProviderResponse ¶
CleanProviderResponse cleans up provider response for XML compatibility
func ConvertToBasicHOCR ¶
func ConvertToBasicHOCR(response OCRResponse) string
ConvertToBasicHOCR converts an OCR response to basic hOCR without LLM transcription
func CreateTextImage ¶
CreateTextImage creates an image containing the specified text
func ExtractWordImage ¶
func ExtractWordImage(imagePath string, bbox BoundingPoly, tempDir string, wordIndex int) (string, error)
ExtractWordImage extracts a word region from the source image
func TranscribeWordsIndividually ¶
func TranscribeWordsIndividually(imagePath string, response OCRResponse, provider providers.Provider, config providers.Config) (string, error)
TranscribeWordsIndividually extracts individual word images and transcribes each one
func WrapInHOCRDocument ¶
WrapInHOCRDocument wraps content in a complete hOCR HTML document
Types ¶
type Block ¶
type Block struct {
BoundingBox BoundingPoly `json:"boundingBox"`
Paragraphs []Paragraph `json:"paragraphs"`
BlockType string `json:"blockType"`
}
type BoundingPoly ¶
type BoundingPoly struct {
Vertices []Vertex `json:"vertices"`
}
type FullTextAnnotation ¶
type OCRResponse ¶
type OCRResponse struct {
Responses []Response `json:"responses"`
}
OCRResponse and related types for word detection
func DetectWordBoundariesCustom ¶
func DetectWordBoundariesCustom(imagePath string) (OCRResponse, error)
DetectWordBoundariesCustom uses custom image processing algorithm to find word boundaries
type Paragraph ¶
type Paragraph struct {
BoundingBox BoundingPoly `json:"boundingBox"`
Words []Word `json:"words"`
}
type Response ¶
type Response struct {
FullTextAnnotation *FullTextAnnotation `json:"fullTextAnnotation"`
}
type Symbol ¶
type Symbol struct {
BoundingBox BoundingPoly `json:"boundingBox"`
Text string `json:"text"`
}
type Word ¶
type Word struct {
BoundingBox BoundingPoly `json:"boundingBox"`
Symbols []Symbol `json:"symbols"`
}
Click to show internal directories.
Click to hide internal directories.