Snooker - Lightweight spam detection for blog comments

Crates.io Docs License

This crate provides a pure-Rust implementation of Jonathan Snook's spam detection algorithm for blog comments.

As described in the afore-linked post, it works on a points system. Points are awarded and deducted based on a variety of rules. If a comments final score is greater than or equal to 1, the comment is considered valid. If the comments final score is 0 then it's considered to be worth of moderating. If the comments final score is below 0 then it's considered to be spam. Each comment starts with a score of 0.

Installation

If you're using Cargo, just add Snooker to your Cargo.toml:

toml [dependencies] snooker = "0.1.0"

Example

Snooker gives the example comment below a score of -10 based off of the following patterns:

```rust use snooker::{Comment, Snooker, Status};

let comment = Comment { author: Some("Johnny B. Goode".tostring()), url: Some("http://my-free-ebook.com".tostring()), body: String::from("

Nice post! Check out our free (for a limited time only) eBook here that's totally relevant

"), previouslyacceptedforemail: None, previouslyrejectedforemail: None, previouscommentbodies: None, };

let snookerresult = Snooker::new(comment); asserteq!(snookerresult.score, -10); asserteq!(snooker_result.status, Status::Spam); ```

License

Snooker is released under the MIT LICENSE.

About

This crate was written by Elliot Jackson.