Documentation
¶
Overview ¶
Go中文分词
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SegmentsToSlice ¶
func SegmentsToString ¶
输出分词结果为字符串
有两种输出模式,以"中华人民共和国"为例
普通模式(searchMode=false)输出一个分词"中华人民共和国/ns "
搜索模式(searchMode=true) 输出普通模式的再细致切分:
"中华/nz 人民/n 共和/nz 共和国/ns 人民共和国/nt 中华人民共和国/ns "
搜索模式主要用于给搜索引擎提供尽可能多的关键字,详情请见Token结构体的注释。
Types ¶
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
Dictionary结构体实现了一个字串前缀树,一个分词可能出现在叶子节点也有可能出现在非叶节点
func NewDictionary ¶
func NewDictionary() *Dictionary
type Segmenter ¶
type Segmenter struct {
// contains filtered or unexported fields
}
分词器结构体
func (*Segmenter) InternalSegment ¶
type Text ¶
type Text []byte
字串类型,可以用来表达
- 一个字元,比如"中"又如"国", 英文的一个字元是一个词
- 一个分词,比如"中国"又如"人口"
- 一段文字,比如"中国有十三亿人口"
Source Files
¶
Click to show internal directories.
Click to hide internal directories.