goseg

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arbitrate

func Arbitrate(termLink *QuickSortTermLink, smart bool) map[int]*TermPath

func LoadLines

func LoadLines(filepath string, lineHandler func(string))

Types

type Comparable

type Comparable interface {
	CompareTo(interface{}) int
}

type Node

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

func (*Node) Content

func (node *Node) Content() interface{}

func (*Node) Next

func (node *Node) Next() *Node

func (*Node) Prev

func (node *Node) Prev() *Node
type QuickSortTermLink struct {
	// contains filtered or unexported fields
}

func (*QuickSortTermLink) Add

func (qstl *QuickSortTermLink) Add(term *Term) bool

func (*QuickSortTermLink) Head

func (qstl *QuickSortTermLink) Head() *TermNode

func (*QuickSortTermLink) IsEmpty

func (qstl *QuickSortTermLink) IsEmpty() bool

func (*QuickSortTermLink) PeekFirst

func (qstl *QuickSortTermLink) PeekFirst() *Term

func (*QuickSortTermLink) PeekLast

func (qstl *QuickSortTermLink) PeekLast() *Term

func (*QuickSortTermLink) PollFirst

func (qstl *QuickSortTermLink) PollFirst() *Term

func (*QuickSortTermLink) PollLast

func (qstl *QuickSortTermLink) PollLast() *Term

func (*QuickSortTermLink) Size

func (qstl *QuickSortTermLink) Size() int

type Segmenter

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

func NewSegmenter

func NewSegmenter(dictionary *dict.Dictionary) *Segmenter

func (*Segmenter) Segment

func (seg *Segmenter) Segment(text string) TermList

type Term

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

func (*Term) Append

func (term *Term) Append(other *Term) bool

func (*Term) BeginPosition

func (term *Term) BeginPosition() int

func (*Term) CompareTo

func (term *Term) CompareTo(o interface{}) int

func (*Term) EndPosition

func (term *Term) EndPosition() int

func (*Term) Equals

func (term *Term) Equals(other *Term) bool

func (*Term) Length

func (term *Term) Length() int

func (*Term) Pos

func (term *Term) Pos() string

func (*Term) SetPos

func (term *Term) SetPos(pos string)

func (*Term) SetText

func (term *Term) SetText(text string)

func (*Term) Text

func (term *Term) Text() string

type TermList

type TermList []*Term

func (TermList) WordSet

func (termList TermList) WordSet() *hashset.Set

func (TermList) Words

func (termList TermList) Words() []*Word

type TermNode

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

func (*TermNode) CompareTo

func (tn *TermNode) CompareTo(o interface{}) int

func (*TermNode) Content

func (tn *TermNode) Content() *Term

func (*TermNode) Next

func (tn *TermNode) Next() *TermNode

func (*TermNode) Prev

func (tn *TermNode) Prev() *TermNode

type TermPath

type TermPath struct {
	QuickSortTermLink
	// contains filtered or unexported fields
}

func NewTermPath

func NewTermPath() *TermPath

func (*TermPath) AddCrossTerm

func (path *TermPath) AddCrossTerm(term *Term) bool

func (*TermPath) AddNotCrossTerm

func (path *TermPath) AddNotCrossTerm(term *Term) bool

func (*TermPath) Begin

func (path *TermPath) Begin() int

func (*TermPath) CompareTo

func (path *TermPath) CompareTo(o interface{}) int

func (*TermPath) Copy

func (path *TermPath) Copy() *TermPath

func (*TermPath) End

func (path *TermPath) End() int

func (*TermPath) HasCrossWith

func (path *TermPath) HasCrossWith(term *Term) bool

func (*TermPath) Length

func (path *TermPath) Length() int

func (*TermPath) RemoveTail

func (path *TermPath) RemoveTail() *Term

func (*TermPath) TermLengthWeight

func (path *TermPath) TermLengthWeight() int

核心的权重函数 term 长度积

func (*TermPath) TermPositionWeight

func (path *TermPath) TermPositionWeight() int

term 位置权重

type Word

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

func (*Word) Pos added in v0.1.2

func (word *Word) Pos() string

func (*Word) Text added in v0.1.2

func (word *Word) Text() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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