xberg

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package xberg implements Eino's document parser interface with the native Xberg extraction engine.

Index

Constants

View Source
const (
	MetaKeyMIMEType          = "xberg_mime_type"
	MetaKeyDocumentIndex     = "xberg_document_index"
	MetaKeyDocumentCount     = "xberg_document_count"
	MetaKeyNativeMetadata    = "xberg_metadata"
	MetaKeyCounts            = "xberg_counts"
	MetaKeyExtractionMethod  = "xberg_extraction_method"
	MetaKeyDetectedLanguages = "xberg_detected_languages"
	MetaKeyTables            = "xberg_tables"
	MetaKeyWarnings          = "xberg_warnings"
	MetaKeyErrors            = "xberg_errors"
	MetaKeyPageNumber        = "xberg_page_number"
	MetaKeyPageBlank         = "xberg_page_blank"
	MetaKeySheetName         = "xberg_sheet_name"
	MetaKeySectionName       = "xberg_section_name"
	MetaKeySpeakerNotes      = "xberg_speaker_notes"
	MetaKeyImageIndices      = "xberg_image_indices"
	MetaKeyChunkIndex        = "xberg_chunk_index"
	MetaKeyTotalChunks       = "xberg_total_chunks"
	MetaKeyByteStart         = "xberg_byte_start"
	MetaKeyByteEnd           = "xberg_byte_end"
	MetaKeyFirstPage         = "xberg_first_page"
	MetaKeyLastPage          = "xberg_last_page"
	MetaKeyHeadingPath       = "xberg_heading_path"
	MetaKeyChunkType         = "xberg_chunk_type"
	MetaKeyElementType       = "xberg_element_type"
	MetaKeyElementMetadata   = "xberg_element_metadata"
)

Variables

This section is empty.

Functions

func WithChunking

func WithChunking(config native.ChunkingConfig) einoparser.Option

func WithDocumentMode

func WithDocumentMode(mode DocumentMode) einoparser.Option

func WithFileConfig

func WithFileConfig(config native.FileExtractionConfig) einoparser.Option

func WithFilename

func WithFilename(filename string) einoparser.Option

func WithForceOCRPages

func WithForceOCRPages(pages ...uint32) einoparser.Option

func WithMIMEType

func WithMIMEType(mimeType string) einoparser.Option

func WithNativeFileConfig

func WithNativeFileConfig(apply func(*native.FileExtractionConfig)) einoparser.Option

WithNativeFileConfig is the escape hatch for Xberg features not covered by the convenience options in this package.

func WithOCR

func WithOCR(config native.OcrConfig) einoparser.Option

func WithOutputFormat

func WithOutputFormat(format native.OutputFormat) einoparser.Option

func WithPDF

func WithPDF(config native.PdfConfig) einoparser.Option

func WithPDFPasswords

func WithPDFPasswords(passwords ...string) einoparser.Option

func WithPages

func WithPages(config native.PageConfig) einoparser.Option

func WithTimeout

func WithTimeout(timeout time.Duration) einoparser.Option

Types

type Config

type Config struct {
	Core         core.Config
	DocumentMode DocumentMode
}

Config combines adapter-specific behavior with the reusable core extractor configuration. Native Xberg settings live in Core.Native.

type DocumentMode

type DocumentMode string
const (
	DocumentModeDocument DocumentMode = "document"
	DocumentModePage     DocumentMode = "page"
	DocumentModeChunk    DocumentMode = "chunk"
	DocumentModeElement  DocumentMode = "element"
)

type Parser

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

func NewParser

func NewParser(ctx context.Context, config *Config) (*Parser, error)

func (*Parser) Parse

func (parser *Parser) Parse(ctx context.Context, reader io.Reader, options ...einoparser.Option) ([]*schema.Document, error)

Jump to

Keyboard shortcuts

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