extractor

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFromExtraction

func BuildFromExtraction(ext *Extraction, chunk *core.Chunk) ([]core.Node, []core.Edge)

BuildFromExtraction 将缓存的原始提取结果绑定到当前 chunk 的 ID/DocID

func ContentHash

func ContentHash(content string) string

ContentHash FNV-1a 哈希,将内容映射为 16 字符的十六进制 key

func SetCachedExtraction

func SetCachedExtraction(store core.CacheStore, hashKey string, ext *Extraction) error

SetCachedExtraction 将实体提取结果写入 CacheStore

Types

type ExtractedEntity

type ExtractedEntity struct {
	Name       string `json:"name"`
	EntityType string `json:"entity_type"`
}

ExtractedEntity 提取的实体

type ExtractedRelation

type ExtractedRelation struct {
	Subject   string `json:"subject"`
	Predicate string `json:"predicate"`
	Object    string `json:"object"`
}

ExtractedRelation 提取的关系

type Extraction

type Extraction struct {
	Entities  []ExtractedEntity   `json:"entities"`
	Relations []ExtractedRelation `json:"relations"`
}

Extraction 原始提取结果,与特定 chunk/doc ID 无关 缓存的是"这段文字包含哪些实体和关系"

func GetCachedExtraction

func GetCachedExtraction(store core.CacheStore, hashKey string) (*Extraction, error)

GetCachedExtraction 从 CacheStore 中查询实体提取缓存 返回 nil 表示缓存未命中

Jump to

Keyboard shortcuts

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