🎨 新增AI客服相关接口

This commit is contained in:
2023-11-10 09:30:29 +08:00
parent 8c5386cb2c
commit 1cf8afb7ba
25 changed files with 803 additions and 15 deletions

32
utils/flashtext/trie.go Normal file
View File

@@ -0,0 +1,32 @@
package flashtext
type Node struct {
children map[rune]*Node // 使用 map 存储叶子节点,key:'char' ,value: *Node
exist map[int]struct{} // 关键词节点是一个完整的匹配词,记录其长度
failure *Node // 记录失败指针
}
func newNode() *Node {
return &Node{
children: make(map[rune]*Node),
exist: make(map[int]struct{}),
}
}
type Match struct {
match string
start int
end int
}
func (m *Match) MatchString() string {
return m.match
}
func (m *Match) Start() int {
return m.start
}
func (m *Match) End() int {
return m.end
}