entity

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IngestEntities

func IngestEntities(db *sql.DB, graph *EntityGraph) error

IngestEntities loads entities.yaml into the database

Types

type AliasMatch

type AliasMatch struct {
	Alias      string
	EntityName string
	EntityType string
	Note       string
}

AliasMatch represents a found alias and its canonical entity

func ExpandQuery

func ExpandQuery(db *sql.DB, query string) (string, []AliasMatch, error)

ExpandQuery replaces aliases with canonical names and adds context. Sorts matches by alias length (longest first) to prevent partial corruption (e.g., "the tree" must be replaced before "tree" gets a chance).

func LookupAliases

func LookupAliases(db *sql.DB, query string) ([]AliasMatch, error)

LookupAliases finds all entity aliases mentioned in the query. Uses word boundaries for ASCII aliases to prevent substring false positives (e.g., alias "AB" must not match inside "ABC").

type Entity

type Entity struct {
	Name        string   `yaml:"name"`
	Type        string   `yaml:"type"`
	Aliases     []string `yaml:"aliases"`
	Description string   `yaml:"description"`
}

Entity represents a named concept with aliases for query expansion

type EntityGraph

type EntityGraph struct {
	Entities []Entity `yaml:"entities"`
}

EntityGraph holds the entity list loaded from entities.yaml

func LoadEntityGraph

func LoadEntityGraph(path string) (*EntityGraph, error)

LoadEntityGraph reads and parses entities.yaml

Jump to

Keyboard shortcuts

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