naive

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsReader added in v0.5.4

func AsReader(text string) io.Reader

Types

type Classifier

type Classifier struct {
	Feat2cat  map[string]map[string]int
	CatCount  map[string]int
	Tokenizer classifier.Tokenizer
	// contains filtered or unexported fields
}

Classifier implements a naive bayes classifier

func New

func New() *Classifier

New initializes a new naive Classifier using the standard tokenizer

func (*Classifier) Probabilities

func (c *Classifier) Probabilities(stringToClassify string) (map[string]float64, string)

Probabilities runs the provided string through the model and returns the potential probabilityForCategory for each classification

func (*Classifier) Train

func (c *Classifier) Train(r io.Reader, category string) error

Train provides supervisory training to the classifier

func (*Classifier) TrainString

func (c *Classifier) TrainString(title string, category string) error

TrainString provides supervisory training to the classifier

Jump to

Keyboard shortcuts

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