corpus

package
v0.0.0-...-762ccde Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandWords

func ExpandWords(wcs []*WordCount) []uint32

Types

type Corpus

type Corpus struct {
	VocabSize uint32
	DocNum    uint32
	Docs      map[uint32][]*WordCount
}

func (*Corpus) AddDoc

func (this *Corpus) AddDoc(docId uint32, wcs []*WordCount)

add one document to corpus with specified docId and word count list, if the specified docId already exists in corpus, the old doc will be overwritted

func (*Corpus) Load

func (this *Corpus) Load(fn string)

load training data from file, the file format should be like: [docId wordId:wordCount wordId:wordCount ... wordId:wordCount] the function will panic if docId, wordId and wordCount cannot be parsed to uint32

type WordCount

type WordCount struct {
	WordId uint32
	Count  uint32
}

Jump to

Keyboard shortcuts

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