classifier

package
v0.0.0-...-c8b2685 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package classifier implements semi-automatic rating of news items.

Index

Constants

View Source
const (
	Good = "good"
	Bad  = "bad"
)

Good and Bad are the two categories for rating news items.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classifier

type Classifier interface {
	Train() error
	Classify(item *feed.Item) (string, error)
	Learn(class string, item *feed.Item) error
	Unlearn(class string, item *feed.Item) error
}

Classifier is a ... well, classifier that tries to tell interesting news from boring ones. Since I am trying to replace it, this type has become an interface so I can swap out several implementations without upsetting the rest of the application's code.

type ClassifierShield

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

ClassifierShield is an implementation of a classifier that uses shield as its Bayes-engine, so to speak.

func NewShield

func NewShield(pool *database.Pool) (*ClassifierShield, error)

NewShield creates and returns a new ClassifierShield.

func (*ClassifierShield) Classify

func (c *ClassifierShield) Classify(item *feed.Item) (string, error)

Classify attempts to find a rating for a news item.

func (*ClassifierShield) Learn

func (c *ClassifierShield) Learn(class string, item *feed.Item) error

func (*ClassifierShield) Train

func (c *ClassifierShield) Train() error

Trains trains the Classifier.

func (*ClassifierShield) Unlearn

func (c *ClassifierShield) Unlearn(class string, item *feed.Item) error

type ClassifierSimple

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

ClassifierSimple is a classical Bayesian classifier that semi-automatically rates news Items.

func NewSimple

func NewSimple() (*ClassifierSimple, error)

NewSimple creates a new Classifier.

func (*ClassifierSimple) Classify

func (c *ClassifierSimple) Classify(item *feed.Item) (string, error)

Classify attempts to find a rating for a news item.

func (*ClassifierSimple) Train

func (c *ClassifierSimple) Train() error

Train trains the model. Duh.

Jump to

Keyboard shortcuts

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