[−][src]Crate rammer
Rammer, a play on Rust and the fact that spam is classified as Spam or Ham, is a spam/ham classification library.
use rammer::{HSModel, BagOfWords}; let spam_bow = BagOfWords::from_folder("data/train/spam"); let ham_bow = BagOfWords::from_folder("data/train/ham"); let model = HSModel::from_bows(ham_bow, spam_bow); model.text_spam_probability("hello i have an offer for you"); model.text_spam_probability("Hey it's greg, finished the data analysis");
Structs
BagOfWords | A BagOfWords, also referred to as a bow, is a frequency map of words. Read more about the BagOfWords model here: BagOfWords Wikipedia. BagOfWords works with Unicode Words. Words are defined by as between UAX#29 word boundaries. BagOfWords is serializable using one of the serde serialization crates |
HSModel | A model which contains 2 BagOfWords, one containing known spam, and the other known ham. |
Type Definitions
Count | Type alias for number of times a word is found in a BagOfWords. |
Frequency | Type alias for rate of occurences of a value. This type should always be between [0,1]. |
Probability | Type alias for the statistical probability of an event. This type should always be between [0,1]. |