[−][src]Struct bayespam::classifier::Classifier
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
Auto Trait Implementations
impl Send for Classifier
impl Sync for Classifier
impl Unpin for Classifier
impl UnwindSafe for Classifier
impl RefUnwindSafe for Classifier
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,