Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { // Children /** * @Author: rym 2022-11-16 09:09:00 * @Description: 该节点的子节点字典 */ Children map[rune]*Node `json:"children"` // ContentMap /** * @Author: rym 2023-03-09 16:00:51 * @Description: 临时用的map,用来作数据去重 */ ContentMap map[string]string // Char /** * @Author: rym 2022-11-16 09:01:47 * @Description: 该节点的字符 */ Char string // ContentList /** * @Author: rym 2022-11-16 09:10:54 * @Description: */ Content []string `json:"content"` // Code /** * @Author: rym 2022-11-16 09:08:38 * @Description: 改节点的unicode */ Code rune }
Node *
- @Author: rym 2022-11-16 09:01:35
- @Description: 数据结构节点对象
type Trie ¶
type Trie struct { // Root /** * @Author: rym 2022-11-16 09:14:41 * @Description: 根节点 */ Root *Node // contains filtered or unexported fields }
Trie *
- @Author: rym 2022-11-16 09:18:42
- @Description:Trie Map 数据结构对象
func (*Trie) Add ¶
Add *
- @Author: rym 2022-11-16 17:39:14
- @Description: 根据关键词添加节点,并下挂相关内容 对外方法
- @Description: 创建普通的树节点 例如: 碳中和 通过 碳、碳中、碳中和 可以查找到对应的内容列表
- @receiver t
- @param keyword
- @param content
func (*Trie) AddFull ¶
AddFull *
- @Author: rym 2022-11-16 17:32:32
- @Description: 根据关键词添加节点,并下挂相关内容 对外方法
- @Description: 创建详细的树节点 例如:碳中和 通过 碳、碳中、碳中和、中、中和、和 都可以查找到对应的内容列表
- @Description: 此方式创建的树,会更多消耗内存
- @receiver t
- @param keyword
- @param content
func (*Trie) AutoAdd ¶
AutoAdd *
- @Author: rym 2023-01-31 17:26:29
- @Description:自动添加非全词搜索
- @receiver t
- @param list
func (*Trie) AutoAddFull ¶
AutoAddFull *
- @Author: rym 2023-01-31 17:24:56
- @Description:自动添加全词搜索
- @receiver t
- @param list
func (*Trie) Find ¶
Find *
- @Author: rym 2022-11-16 09:44:22
- @Description: 根据关键词,从树中找相关内容列表
- @receiver t
- @param keyword
- @return bool
- @return []string
Click to show internal directories.
Click to hide internal directories.