result

package
v0.0.0-...-bc0f8f2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodePosCount

type CodePosCount struct {
	Code  string
	Pos   int
	Count int
}

type Info

type Info struct {
	TextName string
	TextLen  int // 文本字数
	DictName string
	DictLen  int  // 词条数
	Single   bool // 是否为单字码表
}

type MatchRes

type MatchRes struct {
	PartIdx int // 分段索引
	Segment Segment

	// 每个词条对应的编码,以及出现的次数
	StatData map[string]*CodePosCount

	TextLen int // 文章总字数,不管有没有匹配到
	Dist    dist
	Commit  commit
	Char    char
	Pair    pair
	// contains filtered or unexported fields
}

匹配一段文字得到的信息

func NewMatchRes

func NewMatchRes() *MatchRes

func (*MatchRes) Combine

func (m *MatchRes) Combine(mRes *MatchRes)

将每次匹配得到的信息追加到总结果

func (*MatchRes) Stat

func (m *MatchRes) Stat(info *Info) *Result

type Result

type Result struct {
	Info   Info   // 文章和码表信息
	Commit commit // 上屏
	Char   char   // 上屏字数
	Han    han    // 非汉字以及缺字
	Pair   pair   // 按键组合
	Keys   keys   // 按键统计
	// 各种分布
	Dist struct {
		CodeLen   []int   // 码长
		WordLen   []int   // 词长
		Collision []int   // 选重
		Finger    [11]int // 手指

		// 按键 左空格_,右空格+
		Key map[string]int
	}
	// contains filtered or unexported fields
}

func (*Result) OutPutJson

func (res *Result) OutPutJson()

输出 json 数据

func (*Result) OutputSplit

func (res *Result) OutputSplit()

输出分词结果

func (*Result) OutputStat

func (res *Result) OutputStat()

输出词条统计数据

type Segment

type Segment struct {
	// 分段索引
	PartIdx int
	// 每段的分词结果
	Builder *strings.Builder
}

Jump to

Keyboard shortcuts

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