xphotoocr

package
v0.8.21 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 27 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

Index

Constants

View Source
const CompareSchemaVersion = "x_photo_ocr_compare.v1"

Variables

This section is empty.

Functions

func RenderCompareMarkdown

func RenderCompareMarkdown(result CompareResult, maxTextChars int) string

func ResolveModel

func ResolveModel(cfg config.Config, model string) string

Types

type CompareImageResult

type CompareImageResult struct {
	Index        int          `json:"index"`
	ItemID       int64        `json:"item_id"`
	SourceKey    string       `json:"source_key"`
	Title        string       `json:"title,omitempty"`
	CanonicalURL string       `json:"canonical_url,omitempty"`
	NotePath     string       `json:"note_path,omitempty"`
	PhotoOrdinal int          `json:"photo_ordinal"`
	LocalPath    string       `json:"local_path"`
	InputPath    string       `json:"input_path,omitempty"`
	InputSource  string       `json:"input_source,omitempty"`
	RemoteURL    string       `json:"remote_url,omitempty"`
	ExpandedURL  string       `json:"expanded_url,omitempty"`
	ExistingOCR  ExistingOCR  `json:"existing_ocr"`
	Runs         []CompareRun `json:"runs"`
}

type CompareModelSummary

type CompareModelSummary struct {
	Model                      string  `json:"model"`
	OK                         int     `json:"ok"`
	Errors                     int     `json:"errors"`
	TotalDurationMS            int64   `json:"total_duration_ms"`
	AverageDurationMS          int64   `json:"average_duration_ms"`
	TotalChars                 int     `json:"total_chars"`
	AverageChars               int     `json:"average_chars"`
	AverageBaselineWordOverlap float64 `json:"average_baseline_word_overlap,omitempty"`
}

type CompareOptions

type CompareOptions struct {
	Limit           int
	Models          []string
	Concurrency     int
	Timeout         time.Duration
	DownloadMissing bool
	TesseractBinary string
	OpenRouterBase  string
	OpenRouterKey   string
	OpenRouterTitle string
	OpenRouterRef   string
	UserAgent       string
	OllamaBase      string
	OllamaKey       string
}

type CompareResult

type CompareResult struct {
	SchemaVersion string                `json:"schema_version"`
	StartedAt     time.Time             `json:"started_at"`
	FinishedAt    time.Time             `json:"finished_at"`
	DurationMS    int64                 `json:"duration_ms"`
	Limit         int                   `json:"limit"`
	Models        []string              `json:"models"`
	Images        []CompareImageResult  `json:"images"`
	Summary       []CompareModelSummary `json:"summary"`
	Errors        int                   `json:"errors"`
}

func Compare

func Compare(ctx context.Context, cfg config.Config, st *store.Store, opts CompareOptions) (CompareResult, error)

type CompareRun

type CompareRun struct {
	Model                  string  `json:"model"`
	ReportedModel          string  `json:"reported_model,omitempty"`
	Tool                   string  `json:"tool,omitempty"`
	Status                 string  `json:"status"`
	Error                  string  `json:"error,omitempty"`
	Text                   string  `json:"text,omitempty"`
	DurationMS             int64   `json:"duration_ms"`
	CharCount              int     `json:"char_count"`
	LineCount              int     `json:"line_count"`
	WordCount              int     `json:"word_count"`
	BaselineWordOverlap    float64 `json:"baseline_word_overlap,omitempty"`
	BaselineOnlyWordCount  int     `json:"baseline_only_word_count,omitempty"`
	CandidateOnlyWordCount int     `json:"candidate_only_word_count,omitempty"`
}

type ExistingOCR

type ExistingOCR struct {
	Status string `json:"status,omitempty"`
	Model  string `json:"model,omitempty"`
	Tool   string `json:"tool,omitempty"`
	Text   string `json:"text,omitempty"`
}

type Options

type Options struct {
	Limit           int
	Force           bool
	Concurrency     int
	Timeout         time.Duration
	Model           string
	TesseractBinary string
	OpenRouterBase  string
	OpenRouterKey   string
	OpenRouterTitle string
	OpenRouterRef   string
	UserAgent       string
	OllamaBase      string
	OllamaKey       string
	Logger          *slog.Logger
}

type Stats

type Stats struct {
	ItemsQueued     int `json:"items_queued"`
	ItemsProcessed  int `json:"items_processed"`
	ItemsUpdated    int `json:"items_updated"`
	ItemsUnchanged  int `json:"items_unchanged"`
	ItemsSkipped    int `json:"items_skipped"`
	PhotoCandidates int `json:"photo_candidates"`
	PhotosOCRed     int `json:"photos_ocred"`
	HostedAttempts  int `json:"hosted_attempts"`
	HostedFallbacks int `json:"hosted_fallbacks"`
	Errors          int `json:"errors"`
}

func Run

func Run(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Stats, error)

Jump to

Keyboard shortcuts

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