extraction

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package extraction provides entity and relationship extraction from text

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
}

Entity represents a named entity extracted from text

type EntityExtractor

type EntityExtractor struct {
	LLM llm.LLMClient
}

EntityExtractor extracts entities from text using an LLM

func NewEntityExtractor

func NewEntityExtractor(llmClient llm.LLMClient) *EntityExtractor

NewEntityExtractor creates a new entity extractor

func (*EntityExtractor) Extract

func (e *EntityExtractor) Extract(ctx context.Context, text string) ([]Entity, error)

Extract extracts entities from the given text

type RelationExtractor

type RelationExtractor struct {
	LLM llm.LLMClient
}

RelationExtractor extracts relationships between entities from text using an LLM

func NewRelationExtractor

func NewRelationExtractor(llmClient llm.LLMClient) *RelationExtractor

NewRelationExtractor creates a new relation extractor

func (*RelationExtractor) Extract

func (r *RelationExtractor) Extract(ctx context.Context, text string, entities []Entity) ([]Triplet, error)

Extract extracts relationships from the given text using the provided entities

type Triplet

type Triplet struct {
	Subject  string `json:"subject"`
	Relation string `json:"relation"`
	Object   string `json:"object"`
}

Triplet represents a relationship between two entities

Jump to

Keyboard shortcuts

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