ocr

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ocr detects text in documents stored in S3.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoText          = errors.New("no_text")
	ErrPageLimit       = errors.New("ocr_page_limit")
	ErrTextLimit       = errors.New("ocr_text_too_large")
	ErrDetectionFailed = errors.New("ocr_detection_failed")
)

Detection errors identify terminal text and document limits.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client performs asynchronous document text detection.

func New

func New(ctx context.Context, cfg *config.Config) (*Client, error)

New creates a text detector with the shared AWS credentials and retry policy.

func (*Client) AnalyzePages

func (c *Client) AnalyzePages(ctx context.Context, key, profile, window string, pageCount int, accepted func(context.Context) error) (LayoutResults, error)

AnalyzePages submits the stored original for combined LAYOUT and TABLES analysis and reconstructs reading order and structured tables across paginated responses.

func (*Client) Extract

func (c *Client) Extract(parent context.Context, key string) (string, error)

Extract returns detected lines from the stored original document.

func (*Client) ExtractPages

func (c *Client) ExtractPages(ctx context.Context, key, profile, window string, pageCount int, accepted func(context.Context) error) (PageResults, error)

ExtractPages submits the entire original and records acceptance before polling.

type LayoutPage

type LayoutPage struct {
	Present  bool
	Failed   bool
	Partial  bool
	Reason   string
	Sections []domain.LayoutSection
	Text     string
}

LayoutPage holds reconstructed reading-order sections and status for one page.

type LayoutResults

type LayoutResults struct {
	Pages   map[int]LayoutPage
	Partial bool
}

LayoutResults preserves per-page layout output and provider warning flags.

type Page

type Page struct {
	Present bool
	Failed  bool
	Text    string
}

Page is the provider evidence for one page of the submitted document.

type PageResults

type PageResults struct {
	Pages   map[int]Page
	Partial bool
}

PageResults preserves page presence and provider warnings across pagination.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL