paddleocr

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAllTokensExhaustedToday = errors.New("all tokens exhausted for today")

Functions

func CleanTitleText

func CleanTitleText(s string) string

func IsRetryable

func IsRetryable(err error) bool

func MergeChunkResponses

func MergeChunkResponses(results []ocrs.OCRResult) (ocrs.OCRResult, error)

func ParseStructuredChunks

func ParseStructuredChunks(raw []byte) (string, []ocrs.ProcessedChunk, error)

func ParseStructuredChunksByReader

func ParseStructuredChunksByReader(rd io.Reader) (string, []ocrs.ProcessedChunk, error)

Types

type Client

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

func NewClient

func NewClient(name, apiURL, token string, timeout time.Duration, opts ...retrypolicy.Option) *Client

func NewClientWithTokens

func NewClientWithTokens(name, apiURL string, tokens []string, timeout time.Duration, opts ...retrypolicy.Option) *Client

func (*Client) Family

func (c *Client) Family() string

func (*Client) Handle

func (c *Client) Handle(ctx context.Context, data []byte) (ocrs.OCRResult, error)

func (*Client) Name

func (c *Client) Name() string

type DataInfo

type DataInfo struct {
	NumPages int        `json:"numPages"`
	Pages    []PageInfo `json:"pages"`
	Type     string     `json:"type"`
}

type DocPreprocessorRes

type DocPreprocessorRes struct {
	ModelSettings DocPreprocessorSettings `json:"model_settings"`
	Angle         int                     `json:"angle"`
}

type DocPreprocessorSettings

type DocPreprocessorSettings struct {
	UseDocOrientationClassify bool `json:"use_doc_orientation_classify"`
	UseDocUnwarping           bool `json:"use_doc_unwarping"`
}

type LayoutBox

type LayoutBox struct {
	ClsID      int     `json:"cls_id"`
	Label      string  `json:"label"`
	Score      float64 `json:"score"`
	Coordinate []int   `json:"coordinate"`
	Order      *int    `json:"order"`
}

type LayoutDetectionRes

type LayoutDetectionRes struct {
	Boxes []LayoutBox `json:"boxes"`
}

type LayoutParsingResult

type LayoutParsingResult struct {
	PrunedResult PrunedResult      `json:"prunedResult"`
	Markdown     MarkdownResult    `json:"markdown"`
	OutputImages map[string]string `json:"outputImages"`
	InputImage   string            `json:"inputImage"`
}

type MarkdownResult

type MarkdownResult struct {
	Text   string            `json:"text"`
	Images map[string]string `json:"images"`
}

type ModelSettings

type ModelSettings struct {
	UseDocPreprocessor   bool     `json:"use_doc_preprocessor"`
	UseLayoutDetection   bool     `json:"use_layout_detection"`
	UseChartRecognition  bool     `json:"use_chart_recognition"`
	UseSealRecognition   bool     `json:"use_seal_recognition"`
	UseOCRForImageBlock  bool     `json:"use_ocr_for_image_block"`
	FormatBlockContent   bool     `json:"format_block_content"`
	MergeLayoutBlocks    bool     `json:"merge_layout_blocks"`
	MarkdownIgnoreLabels []string `json:"markdown_ignore_labels"`
}

type OCRResponse

type OCRResponse struct {
	LogID     string    `json:"logId"`
	Result    OCRResult `json:"result"`
	ErrorCode int       `json:"errorCode"`
	ErrorMsg  string    `json:"errorMsg"`
}

type OCRResult

type OCRResult struct {
	LayoutParsingResults []LayoutParsingResult `json:"layoutParsingResults"`
	DataInfo             DataInfo              `json:"dataInfo"`
	PreprocessedImages   []string              `json:"preprocessedImages"`
}

type PageInfo

type PageInfo struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

type ParsingBlock

type ParsingBlock struct {
	BlockLabel   string `json:"block_label"`
	BlockContent string `json:"block_content"`
	BlockBBox    []int  `json:"block_bbox"`
	BlockID      int    `json:"block_id"`
	BlockOrder   *int   `json:"block_order"`
	GroupID      int    `json:"group_id"`
}

type PrunedResult

type PrunedResult struct {
	PageCount          int                `json:"page_count"`
	Width              int                `json:"width"`
	Height             int                `json:"height"`
	ModelSettings      ModelSettings      `json:"model_settings"`
	ParsingResList     []ParsingBlock     `json:"parsing_res_list"`
	DocPreprocessorRes DocPreprocessorRes `json:"doc_preprocessor_res"`
	LayoutDetRes       LayoutDetectionRes `json:"layout_det_res"`
}

Jump to

Keyboard shortcuts

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