segmenter

package
v0.0.0-...-5e73d17 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2016 License: GPL-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MinTokenFrequency = 2 // 仅从字典文件中读取大于等于此频率的分词
)

分词器接口

Variables

This section is empty.

Functions

This section is empty.

Types

type ChinaCut

type ChinaCut struct {
	// contains filtered or unexported fields
}

分词器结构体

func InitChinaCut

func InitChinaCut(files string) *ChinaCut

func (*ChinaCut) Cut

func (self *ChinaCut) Cut(bytes []byte, model bool) []search.Segment

对文本分词 输入参数:

bytes	UTF8文本的字节数组

输出:

[]Segment	划分的分词

func (*ChinaCut) Dictionary

func (self *ChinaCut) Dictionary() *search.Dictionary

返回分词器使用的词典

func (*ChinaCut) LoadDictionary

func (self *ChinaCut) LoadDictionary(files string)

从文件中载入词典 可以载入多个词典文件,文件名用","分隔,排在前面的词典优先载入分词,比如

"用户词典.txt,通用词典.txt"

当一个分词既出现在用户词典也出现在通用词典中,则优先使用用户词典。 词典的格式为(每个分词一行):

分词文本 频率 词性

Jump to

Keyboard shortcuts

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