ocr

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 18 Imported by: ? 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunClient

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

func NewAliyunClient

func NewAliyunClient(c AliyunConf) *AliyunClient

func (*AliyunClient) OCRText

func (a *AliyunClient) OCRText(imgBase64 string) (string, error)

type AliyunConf

type AliyunConf struct {
	AppCode  string `json:"appcode"`
	Endpoint string `json:"endpoint"`
}

type BaiduClient

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

func NewBaiduClient

func NewBaiduClient(conf BaiduConf) *BaiduClient

func (*BaiduClient) OCRText

func (b *BaiduClient) OCRText(imgBase64 string) (string, error)

type BaiduConf

type BaiduConf struct {
	AK       string `json:"ak"`
	SK       string `json:"sk"`
	TokenURL string `json:"token_url"`
	OCRURL   string `json:"ocr_url"`
}

type Client

type Client interface {
	OCRText(imgBase64 string) (string, error)
}

type OcrServiceProvider

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

func (*OcrServiceProvider) Boot

func (i *OcrServiceProvider) Boot(ctx context.Context) error

func (*OcrServiceProvider) Conf

func (i *OcrServiceProvider) Conf() map[string]string

func (*OcrServiceProvider) Description

func (i *OcrServiceProvider) Description() string

func (*OcrServiceProvider) Register

func (i *OcrServiceProvider) Register(ctx context.Context) error

func (*OcrServiceProvider) SetApplication

func (i *OcrServiceProvider) SetApplication(app foundation.Application)

type Options

type Options struct {
	Provider string      `json:"provider"`
	Baidu    BaiduConf   `json:"baidu"`
	Aliyun   AliyunConf  `json:"aliyun"`
	Tencent  TencentConf `json:"tencent"`
}

type Service

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

func NewService

func NewService(c Client) *Service

func (*Service) OCRText

func (s *Service) OCRText(imgBytes []byte) (string, error)

func (*Service) OCRTextFromFile

func (s *Service) OCRTextFromFile(path string) (string, error)

type TencentClient

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

func NewTencentClient

func NewTencentClient(c TencentConf) *TencentClient

func (*TencentClient) OCRText

func (t *TencentClient) OCRText(imgBase64 string) (string, error)

type TencentConf

type TencentConf struct {
	SecretID  string `json:"secret_id"`
	SecretKey string `json:"secret_key"`
	Region    string `json:"region"`
	Version   string `json:"version"`
}

Source Files

  • aliyun.go
  • baidu.go
  • ocr_service_provider.go
  • service.go
  • tencent.go

Jump to

Keyboard shortcuts

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