Files
HomeAgent/internal/nlp/model.go
root 1cb3e87dde feat: 完整实现 NLP 三元组提取系统 + token budget 上下文分配
- 重写 extractor.go: 分句、17条 POS 模板、依存模板 + COO 链、ATT合并
- parser.go: 分句循环 + TransE 向量验证(h+r≈t)
- fallback.go: jieba POS 降级解析器
- bridge.go: nlp.Triple ↔ memory.Triple 转换
- pipeline.go: extractKeyTriples 改用 NLP 提取器, 删除5条旧前缀规则
- distill.go: docToTriples 改用 NLP 提取器
- reorgGraph: 语义相似度增强检测, 保持纯 LLM 决断
- Provider 接口加 MaxContextTokens() + 模型窗口映射表
- tokenbudget.go: 中文 token 估算器 + budget 分配(80%利用率)
- process.go/buildSystemPrompt: 按 token 预算截断 memory+timeline
2026-07-27 15:26:23 +08:00

26 lines
524 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package nlp
// ParseResult 依存句法分析结果
type ParseResult struct {
Tokens []string
POS []string
Heads []int // 父节点索引0=ROOT
DepRels []string // 依存关系标签
}
// Triple 三元组 (subject, relation, object)
type Triple struct {
Subject string
Relation string
Object string
Score float64
Src string // "dep" / "fallback"
}
// TripleSet 提取结果
type TripleSet struct {
Triples []Triple
Src string // "dep_parser" / "fallback" / ""
Err error
}