extractor

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	Name       string
	Type       string
	Confidence float64
	Source     string // "regex" or "ollama"
}

Entity represents an extracted entity

type ExtractionResult

type ExtractionResult struct {
	Entities      []Entity
	Relationships []Relationship
	Duration      time.Duration
	Extractor     string
}

ExtractionResult contains all extracted information and metadata

type Extractor

type Extractor interface {
	Extract(text string) ([]Entity, []Relationship, error)
	Name() string
}

Extractor is the interface for entity extraction strategies

type OllamaExtractor

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

func NewOllamaExtractor

func NewOllamaExtractor(model string) (*OllamaExtractor, error)

func (*OllamaExtractor) Available

func (o *OllamaExtractor) Available(ctx context.Context) bool

Available checks if Ollama is running and reachable

func (*OllamaExtractor) Extract

func (o *OllamaExtractor) Extract(text string) ([]Entity, []Relationship, error)

func (*OllamaExtractor) ListModels

func (o *OllamaExtractor) ListModels(ctx context.Context) ([]string, error)

ListModels returns a list of installed Ollama models

func (*OllamaExtractor) Name

func (o *OllamaExtractor) Name() string

func (*OllamaExtractor) PullModel

func (o *OllamaExtractor) PullModel(ctx context.Context, model string, progress func(api.ProgressResponse) error) error

PullModel pulls a model from the Ollama library

type Pipeline

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

func NewPipeline

func NewPipeline(ollamaModel string) *Pipeline

func (*Pipeline) Run

func (p *Pipeline) Run(ctx context.Context, text string) (*ExtractionResult, error)

type RegexExtractor

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

func NewRegexExtractor

func NewRegexExtractor() *RegexExtractor

func (*RegexExtractor) Extract

func (r *RegexExtractor) Extract(text string) ([]Entity, []Relationship, error)

func (*RegexExtractor) Name

func (r *RegexExtractor) Name() string

type Relationship

type Relationship struct {
	FromEntity string
	ToEntity   string
	Type       string
	Confidence float64
	Source     string // "regex" or "ollama"
}

Relationship represents a dependency between two entities

func ExtractRelationships

func ExtractRelationships(text string) []Relationship

ExtractRelationships extracts explicit relationships from text Pattern: "- EntityA -> EntityB (relationship)"

Jump to

Keyboard shortcuts

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