Documentation
¶
Overview ¶
Package classifier implements semi-automatic rating of news items.
Index ¶
Constants ¶
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.
type ClassifierSimple ¶
type ClassifierSimple struct {
// contains filtered or unexported fields
}
ClassifierSimple is a classical Bayesian classifier that semi-automatically rates news Items.
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.