normalisers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocxNormaliser added in v0.3.0

type DocxNormaliser struct{}

DocxNormaliser extracts text content from DOCX files using docconv.

func (*DocxNormaliser) Normalise added in v0.3.0

func (n *DocxNormaliser) Normalise(content string, mimeType string) string

func (*DocxNormaliser) Priority added in v0.3.0

func (n *DocxNormaliser) Priority() int

func (*DocxNormaliser) SupportedTypes added in v0.3.0

func (n *DocxNormaliser) SupportedTypes() []string

type GitHubIssueNormaliser

type GitHubIssueNormaliser struct{}

GitHubIssueNormaliser handles GitHub issue content. It preserves Markdown formatting while cleaning up issue-specific artifacts.

func (*GitHubIssueNormaliser) Normalise

func (n *GitHubIssueNormaliser) Normalise(content string, mimeType string) string

func (*GitHubIssueNormaliser) Priority

func (n *GitHubIssueNormaliser) Priority() int

func (*GitHubIssueNormaliser) SupportedTypes

func (n *GitHubIssueNormaliser) SupportedTypes() []string

type GitHubPRNormaliser

type GitHubPRNormaliser struct{}

GitHubPRNormaliser handles GitHub pull request content. It preserves Markdown formatting while cleaning up PR-specific artifacts.

func (*GitHubPRNormaliser) Normalise

func (n *GitHubPRNormaliser) Normalise(content string, mimeType string) string

func (*GitHubPRNormaliser) Priority

func (n *GitHubPRNormaliser) Priority() int

func (*GitHubPRNormaliser) SupportedTypes

func (n *GitHubPRNormaliser) SupportedTypes() []string

type HTMLNormaliser

type HTMLNormaliser struct{}

HTMLNormaliser parses HTML into structured plain text. Headings keep their level as ATX-style markdown (`# `, `## `, …) so a section-aware chunker can split on `^#+ `; image alt and link title text are preserved inline; script, style, and other non-content elements are dropped wholesale.

func (*HTMLNormaliser) Normalise

func (n *HTMLNormaliser) Normalise(content string, mimeType string) string

func (*HTMLNormaliser) Priority

func (n *HTMLNormaliser) Priority() int

func (*HTMLNormaliser) SupportedTypes

func (n *HTMLNormaliser) SupportedTypes() []string

type MarkdownNormaliser

type MarkdownNormaliser struct{}

MarkdownNormaliser handles Markdown content.

func (*MarkdownNormaliser) Normalise

func (n *MarkdownNormaliser) Normalise(content string, mimeType string) string

func (*MarkdownNormaliser) Priority

func (n *MarkdownNormaliser) Priority() int

func (*MarkdownNormaliser) SupportedTypes

func (n *MarkdownNormaliser) SupportedTypes() []string

type PDFNormaliser added in v0.2.2

type PDFNormaliser struct{}

PDFNormaliser extracts text content from PDF files using pdftotext-go. Requires poppler-utils >= 22.05.0 to be installed.

Pages are emitted as `## Page N` headings between blocks of content. PDFs don't expose section structure to pdftotext (font sizes / styles are gone by the time the text comes back), so the page boundary is the only reliable structural signal we have. Encoding it as an ATX heading lets a section-aware chunker keep page-coherent windows and lets a presenter cite "from page 7" later.

func (*PDFNormaliser) Normalise added in v0.2.2

func (n *PDFNormaliser) Normalise(content string, mimeType string) string

func (*PDFNormaliser) Priority added in v0.2.2

func (n *PDFNormaliser) Priority() int

func (*PDFNormaliser) SupportedTypes added in v0.2.2

func (n *PDFNormaliser) SupportedTypes() []string

type PlaintextNormaliser

type PlaintextNormaliser struct{}

PlaintextNormaliser handles plain text content.

func (*PlaintextNormaliser) Normalise

func (n *PlaintextNormaliser) Normalise(content string, mimeType string) string

func (*PlaintextNormaliser) Priority

func (n *PlaintextNormaliser) Priority() int

func (*PlaintextNormaliser) SupportedTypes

func (n *PlaintextNormaliser) SupportedTypes() []string

type PptxNormaliser added in v0.3.0

type PptxNormaliser struct{}

PptxNormaliser extracts text content from PPTX files using docconv.

func (*PptxNormaliser) Normalise added in v0.3.0

func (n *PptxNormaliser) Normalise(content string, mimeType string) string

func (*PptxNormaliser) Priority added in v0.3.0

func (n *PptxNormaliser) Priority() int

func (*PptxNormaliser) SupportedTypes added in v0.3.0

func (n *PptxNormaliser) SupportedTypes() []string

type Registry

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

Registry implements NormaliserRegistry with priority-based selection. When multiple normalisers match a MIME type, the highest priority one is used.

func DefaultRegistry

func DefaultRegistry() *Registry

DefaultRegistry creates a registry with common normalisers pre-registered.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new normaliser registry.

func (*Registry) Get

func (r *Registry) Get(mimeType string) driven.Normaliser

Get retrieves the best-matching normaliser for a MIME type. Returns nil if no normaliser is registered for the type. When multiple match, the highest priority normaliser is returned.

func (*Registry) GetAll

func (r *Registry) GetAll(mimeType string) []driven.Normaliser

GetAll retrieves all normalisers that match a MIME type, sorted by priority (highest first).

func (*Registry) List

func (r *Registry) List() []string

List returns all registered MIME types.

func (*Registry) Register

func (r *Registry) Register(normaliser driven.Normaliser)

Register registers a normaliser. Normalisers are stored and later selected by priority.

type XlsxNormaliser added in v0.3.0

type XlsxNormaliser struct{}

XlsxNormaliser extracts text content from XLSX files using excelize. It extracts text from all sheets with tab-separated cell values.

func (*XlsxNormaliser) Normalise added in v0.3.0

func (n *XlsxNormaliser) Normalise(content string, mimeType string) string

func (*XlsxNormaliser) Priority added in v0.3.0

func (n *XlsxNormaliser) Priority() int

func (*XlsxNormaliser) SupportedTypes added in v0.3.0

func (n *XlsxNormaliser) SupportedTypes() []string

Jump to

Keyboard shortcuts

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