tiresearch

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

tiresearch

搜索引擎

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	//  Char
	/**
	 *  @Author: rym 2022-11-16 09:01:47
	 *  @Description: 该节点的字符
	 */
	Char string

	//  Code
	/**
	 *  @Author: rym 2022-11-16 09:08:38
	 *  @Description: 改节点的unicode
	 */
	Code rune

	//  Children
	/**
	 *  @Author: rym 2022-11-16 09:09:00
	 *  @Description: 该节点的子节点字典
	 */
	Children map[rune]*Node `json:"children"`

	//  ContentList
	/**
	 *  @Author: rym 2022-11-16 09:10:54
	 *  @Description:
	 */
	Content []string `json:"content"`
}

Node *

  • @Author: rym 2022-11-16 09:01:35
  • @Description: 数据结构节点对象

type Tire

type Tire struct {
	//  Root
	/**
	 *  @Author: rym 2022-11-16 09:14:41
	 *  @Description: 根节点
	 */
	Root *Node
	// contains filtered or unexported fields
}

Tire *

  • @Author: rym 2022-11-16 09:18:42
  • @Description:Tire Map 数据结构对象

func NewTire

func NewTire() *Tire

func (*Tire) Add

func (t *Tire) Add(keyword, content string)

Add *

  • @Author: rym 2022-11-16 17:39:14
  • @Description: 根据关键词添加节点,并下挂相关内容 对外方法
  • @Description: 创建普通的树节点 例如: 碳中和 通过 碳、碳中、碳中和 可以查找到对应的内容列表
  • @receiver t
  • @param keyword
  • @param content

func (*Tire) AddFull

func (t *Tire) AddFull(keyword, content string)

AddFull *

  • @Author: rym 2022-11-16 17:32:32
  • @Description: 根据关键词添加节点,并下挂相关内容 对外方法
  • @Description: 创建详细的树节点 例如:碳中和 通过 碳、碳中、碳中和、中、中和、和 都可以查找到对应的内容列表
  • @Description: 此方式创建的树,会更多消耗内存
  • @receiver t
  • @param keyword
  • @param content

func (*Tire) AutoAdd added in v0.0.2

func (t *Tire) AutoAdd(list []string)

AutoAdd *

  • @Author: rym 2023-01-31 17:26:29
  • @Description:自动添加非全词搜索
  • @receiver t
  • @param list

func (*Tire) AutoAddFull added in v0.0.2

func (t *Tire) AutoAddFull(list []string)

AutoAddFull *

  • @Author: rym 2023-01-31 17:24:56
  • @Description:自动添加全词搜索
  • @receiver t
  • @param list

func (*Tire) Find

func (t *Tire) Find(keyword string) (bool, []string)

Find *

  • @Author: rym 2022-11-16 09:44:22
  • @Description: 根据关键词,从树中找相关内容列表
  • @receiver t
  • @param keyword
  • @return bool
  • @return []string

func (*Tire) SetDepth

func (t *Tire) SetDepth(n int8)

SetDepth *

  • @Author: rym 2022-11-16 09:41:27
  • @Description: 设置树的最大深度 深度越大 查找速度越慢
  • @receiver t
  • @param n

Jump to

Keyboard shortcuts

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