patterns

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package patterns defines the YAML schema and loader for extraction rule sets.

A PatternSet is a collection of regex-based extraction rules keyed by language. Templates use {{subject}} and {{object}} placeholders that expand to named capture groups for SPO triple extraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandTemplate

func ExpandTemplate(tmpl string) string

ExpandTemplate converts a template with placeholders into a regex string.

Types

type Pattern

type Pattern struct {
	Name       string   `yaml:"name"`
	Predicate  string   `yaml:"predicate"`
	Templates  []string `yaml:"templates"`
	Functional bool     `yaml:"functional"`
	Confidence float64  `yaml:"confidence"`
}

Pattern defines a single extraction rule.

type PatternSet

type PatternSet struct {
	Language         string    `yaml:"language"`
	Version          int       `yaml:"version"`
	ClauseSeparators []string  `yaml:"clause_separators"`
	Patterns         []Pattern `yaml:"patterns"`
}

PatternSet is the top-level YAML structure for a language-specific rule file.

func Load

func Load(data []byte) (*PatternSet, error)

Load reads and validates a YAML pattern file.

func (*PatternSet) Validate

func (ps *PatternSet) Validate() error

Validate checks a PatternSet for correctness.

Jump to

Keyboard shortcuts

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