model

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 6 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CitationSpan

type CitationSpan struct {
	ID             string     `json:"id"`
	PassageID      string     `json:"passageId,omitempty"`
	Text           string     `json:"text"`
	Offset         TextOffset `json:"offset"`
	ReferenceIndex int        `json:"referenceIndex"`
	Confidence     float64    `json:"confidence,omitempty"`
}

CitationSpan records a citation mention and its stable offset in parsed text.

type LayeredAnnotation

type LayeredAnnotation struct {
	ID         string     `json:"id"`
	Layer      string     `json:"layer"`
	Label      string     `json:"label,omitempty"`
	Text       string     `json:"text,omitempty"`
	Offset     TextOffset `json:"offset"`
	ParserName string     `json:"parserName,omitempty"`
	Confidence float64    `json:"confidence,omitempty"`
}

LayeredAnnotation records parser layer output such as section, paragraph, reference, or table annotations.

type ParseOptions

type ParseOptions struct {
	PaperID string
}

ParseOptions configures one parse request.

type ParsedAuthor

type ParsedAuthor struct {
	Given  string
	Family string
}

ParsedAuthor is a TEI-normalized author.

type ParsedDocument

type ParsedDocument struct {
	SchemaVersion         string
	PaperID               string
	ParserName            string
	ParserVersion         string
	Title                 string
	TitleOffset           TextOffset
	Authors               []ParsedAuthor
	Abstract              string
	AbstractOffset        TextOffset
	Sections              []Section
	References            []Reference
	Warnings              []string
	ParserConfidence      float64
	LayeredAnnotations    []LayeredAnnotation
	CitationSpans         []CitationSpan
	ReconciliationOutputs []ParserReconciliationOutput
	// ContentHash is sha256:<hex> of the UTF-8 text stream used by offsets:
	// title, abstract, section headings/passages, then reference display text,
	// separated by one newline (including empty fields), with no trailing newline.
	// Parser metadata, IDs, annotations and confidence are not text content.
	ContentHash string
}

ParsedDocument is normalized structured paper content.

func EnrichParsedDocumentModel

func EnrichParsedDocumentModel(doc ParsedDocument) ParsedDocument

EnrichParsedDocumentModel fills deterministic content hashes, local offsets, layer annotations, citation spans, and parser confidence, preserving passage IDs.

type ParserAdapter

type ParserAdapter interface {
	Parse(context.Context, []byte, ParseOptions) (ParsedDocument, error)
}

ParserAdapter parses a source document into a structured ParsedDocument.

type ParserOutputPolicy

type ParserOutputPolicy struct {
	ParserName         string   `json:"parserName"`
	ParserSource       string   `json:"parserSource"`
	LicenseConstraints string   `json:"licenseConstraints"`
	Shareability       string   `json:"shareability"`
	ProvenanceFields   []string `json:"provenanceFields"`
}

type ParserOutputPolicyRegistry

type ParserOutputPolicyRegistry struct {
	SchemaVersion string               `json:"schemaVersion"`
	Policies      []ParserOutputPolicy `json:"policies"`
}

func DefaultParserOutputPolicies

func DefaultParserOutputPolicies() ParserOutputPolicyRegistry

func (ParserOutputPolicyRegistry) MustPolicy

func (r ParserOutputPolicyRegistry) MustPolicy(parserName string) ParserOutputPolicy

func (ParserOutputPolicyRegistry) Policy

func (r ParserOutputPolicyRegistry) Policy(parserName string) (ParserOutputPolicy, bool)

type ParserReconciliationAlt

type ParserReconciliationAlt struct {
	ParserName string     `json:"parserName"`
	Value      string     `json:"value"`
	Offset     TextOffset `json:"offset"`
	Warnings   []string   `json:"warnings,omitempty"`
}

type ParserReconciliationOutput

type ParserReconciliationOutput struct {
	Field          string                    `json:"field"`
	AcceptedParser string                    `json:"acceptedParser"`
	AcceptedValue  string                    `json:"acceptedValue"`
	Reason         string                    `json:"reason"`
	Alternatives   []ParserReconciliationAlt `json:"alternatives,omitempty"`
}

ParserReconciliationOutput records field-level multi-parser reconciliation.

type ParserRunManifest

type ParserRunManifest struct {
	SchemaVersion            string   `json:"schemaVersion"`
	PaperID                  string   `json:"paperId"`
	ParserName               string   `json:"parserName"`
	ParserVersion            string   `json:"parserVersion"`
	ParserSource             string   `json:"parserSource"`
	OutputKind               string   `json:"outputKind"`
	Command                  []string `json:"command,omitempty"`
	InputChecksum            string   `json:"inputChecksum"`
	OutputChecksum           string   `json:"outputChecksum"`
	ParsedPath               string   `json:"parsedPath"`
	LicenseConstraints       string   `json:"licenseConstraints"`
	Shareability             string   `json:"shareability"`
	ProvenanceFields         []string `json:"provenanceFields"`
	ReviewerApprovalRequired bool     `json:"reviewerApprovalRequired"`
	Sections                 int      `json:"sections"`
	Passages                 int      `json:"passages"`
	References               int      `json:"references"`
	Warnings                 []string `json:"warnings,omitempty"`
}

ParserRunManifest records auditable parser-run provenance and layer counts.

func NewParserRunManifest

func NewParserRunManifest(doc ParsedDocument, input []byte, parsedPath string) ParserRunManifest

NewParserRunManifest summarizes one parser output for reproducibility and comparison.

func NewParserRunManifestWithOutput

func NewParserRunManifestWithOutput(doc ParsedDocument, input, output []byte, parsedPath string, command []string) ParserRunManifest

type Passage

type Passage struct {
	ID                 string
	PaperID            string
	SectionID          string
	Text               string
	Offset             TextOffset
	ParserConfidence   float64
	LayeredAnnotations []LayeredAnnotation
	CitationSpans      []CitationSpan
	// ContentHash is sha256:<hex> of Text's exact stored UTF-8 bytes, without
	// further normalization. IDs remain parser-assigned for compatibility.
	ContentHash string
}

Passage is one retrievable section passage.

type Reference

type Reference struct {
	Title      string
	DOI        string
	Raw        string
	Confidence float64
	Offset     TextOffset
}

Reference is one parsed bibliography reference.

type Section

type Section struct {
	ID               string
	Title            string
	Offset           TextOffset
	ParserConfidence float64
	Passages         []Passage
}

Section is one parsed full-text section.

type TextOffset

type TextOffset struct {
	Start int `json:"start"`
	End   int `json:"end"`
}

Jump to

Keyboard shortcuts

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