textboxtally

package
v0.0.0-...-447731e Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	Text  string `json:"text"`
	Count int    `json:"count"`
}

Entity represents a single entity.

type Keyword

type Keyword struct {
	Keyword string `json:"keyword"`
	Count   int    `json:"count"`
}

Keyword represents a keyword with frequency.

type Tally

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

Tally keeps a summary of textbox.Analysis objects.

func New

func New() *Tally

New makes a new Tally.

func (*Tally) Add

func (t *Tally) Add(analysis *textbox.Analysis)

Add adds the textbox.Analysis to this tally.

func (*Tally) AllEntities

func (t *Tally) AllEntities() map[string][]Entity

AllEntities gets all entities mapped by their type.

func (*Tally) AllKeywords

func (t *Tally) AllKeywords() []Keyword

AllKeywords gets an unordered list of keywords.

May be sorted with:

sort.SliceStable(keywords, func(i, j int) bool {
	return keywords[j].Count < keywords[i].Count
})

func (*Tally) Count

func (t *Tally) Count() int

Count gets the number of textbox.Analysis objects that have been included.

func (*Tally) SentimentAverage

func (t *Tally) SentimentAverage() float64

SentimentAverage is the average sentiment of all sentences seen so far.

func (*Tally) TopEntities

func (t *Tally) TopEntities() map[string][]Entity

TopEntities gets the top ten entities sorted by most frequent, mapped on their type.

func (*Tally) TopKeywords

func (t *Tally) TopKeywords() []Keyword

TopKeywords gets the top ten keywords sorted by most frequent.

Jump to

Keyboard shortcuts

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