sego

package module
v0.0.0-...-581280d Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

sego

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBC2SBC

func DBC2SBC(s string) string

半角->全角

func If

func If(condition bool, trueVal, falseVal interface{}) interface{}

func SBC2DBC

func SBC2DBC(s string) string

全角->半角

func SegmentsToSlice

func SegmentsToSlice(segs []Segment, searchMode bool) (output []string)

Types

type Segment

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

文本中的一个分词

func (*Segment) End

func (s *Segment) End() int

返回分词在文本中的结束字节位置(不包括该位置)

func (*Segment) Start

func (s *Segment) Start() int

返回分词在文本中的起始字节位置

func (*Segment) Token

func (s *Segment) Token() *Token

返回分词信息

type Segmenter

type Segmenter struct {
}

分词器结构体

func (*Segmenter) LoadDictionary

func (seg *Segmenter) LoadDictionary(files string)

func (*Segmenter) Segment

func (seg *Segmenter) Segment(bytes []byte) []Segment

type Text

type Text []byte

字串类型,可以用来表达

  1. 一个字元,比如"中"又如"国", 英文的一个字元是一个词
  2. 一个分词,比如"中国"又如"人口"
  3. 一段文字,比如"中国有十三亿人口"

type Token

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

一个分词

func (*Token) Frequency

func (token *Token) Frequency() int

返回分词在语料库中的词频

func (*Token) Pos

func (token *Token) Pos() string

返回分词词性标注

func (*Token) Segments

func (token *Token) Segments() []*Segment

该分词文本的进一步分词划分,比如"中华人民共和国中央人民政府"这个分词 有两个子分词"中华人民共和国"和"中央人民政府"。子分词也可以进一步有子分词 形成一个树结构,遍历这个树就可以得到该分词的所有细致分词划分,这主要 用于搜索引擎对一段文本进行全文搜索。

func (*Token) Text

func (token *Token) Text() string

返回分词文本

type WordInfo

type WordInfo struct {
	Word     string
	IsEntity bool
	wenwen_seg.QueryTermInfo
}

func SegmentQuery

func SegmentQuery(query string, useEntity bool) (words []WordInfo, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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