Please type in a text!
\n\n"; elseif(isset($_POST['action']) and $_POST['text'] != "") { $time_start = microtimeFloat(); # Include the b8 code require dirname(__FILE__) . "/../b8/b8.php"; # Create a new b8 instance $b8 = new b8($config_b8, $config_database); # Check if everything worked smoothly $started_up = $b8->validate(); if($started_up !== TRUE) { echo "example: Could not initialize b8. error code: $started_up"; exit; } $text = stripslashes($_POST['text']); $postedText = htmlentities($text, ENT_QUOTES, 'UTF-8'); switch($_POST['action']) { case "Classify": echo "Spaminess: " . formatRating($b8->classify($text)) . "
\n"; break; case "Save as Spam": $ratingBefore = $b8->classify($text); $b8->learn($text, b8::SPAM); $ratingAfter = $b8->classify($text); echo "Saved the text as Spam
\n\n"; echo "Classification before learning: | " . formatRating($ratingBefore) . " |
Classification after learning: | " . formatRating($ratingAfter) . " |
Saved the text as Ham
\n\n"; echo "Classification before learning: | " . formatRating($ratingBefore) . " |
Classification after learning: | " . formatRating($ratingAfter) . " |
Deleted the text from Spam
\n\n"; break; case "Delete from Ham": $b8->unlearn($text, b8::HAM); echo "Deleted the text from Ham
\n\n"; break; } $mem_used = round(memory_get_usage() / 1048576, 5); $peak_mem_used = round(memory_get_peak_usage() / 1048576, 5); $time_taken = round(microtimeFloat() - $time_start, 5); } echo <<Memory used: | $mem_used MB |
Peak memory used: | $peak_mem_used MB |
Time taken: | $time_taken sec |