Documentation
¶
Index ¶
- type CitationSpan
- type LayeredAnnotation
- type ParseOptions
- type ParsedAuthor
- type ParsedDocument
- type ParserAdapter
- type ParserOutputPolicy
- type ParserOutputPolicyRegistry
- type ParserReconciliationAlt
- type ParserReconciliationOutput
- type ParserRunManifest
- type Passage
- type Reference
- type Section
- type TextOffset
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 ¶
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 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"`
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.