[][src]Struct bayespam::classifier::Classifier

pub struct Classifier { /* fields omitted */ }

A bayesian spam classifier.

Methods

impl Classifier[src]

pub fn new() -> Self[src]

Build a new Classifier with an empty Model.

pub fn new_from_pre_trained(file: &mut File) -> Result<Self, Error>[src]

Build a new Classifier with a pre-trained Model.

  • file - File. The file to read the pre-trained model from.

pub fn save(&self, file: &mut File, pretty: bool) -> Result<(), Error>[src]

Save the Model into the given file.

  • file - File. The file to write to.
  • pretty - Boolean. Pretty-printed JSON or not.

pub fn train_spam(&mut self, msg: &str)[src]

Train the Model of the Classifier with a spam.

  • msg - String. Represents the spam message.

pub fn train_ham(&mut self, msg: &str)[src]

Train the Model of the Classifier with a ham.

  • msg - String. Represents the ham message.

pub fn score(&self, msg: &str) -> f32[src]

Calculate and return the spam score of the message. The higher the score, the stronger the liklihood that the message is a spam is.

  • msg - String. Represents the message to score.

pub fn identify(&self, msg: &str) -> bool[src]

Identify whether the message is a spam or not.

  • msg - String. Represents the message to identify.

Trait Implementations

impl Default for Classifier[src]

impl Debug for Classifier[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]