PHP Classes
elePHPant
Icontem

File: spamfilterTest.php

Recommend this page to a friend!
  Classes of Rafael Pinto  >  Spam Filter  >  spamfilterTest.php  >  Download  
File: spamfilterTest.php
Role: Unit test script
Content type: text/plain
Description: SpamFilter Test
Class: Spam Filter
Classify spam text messages using a knowlegde base
Author: By
Last change:
Date: 13 years ago
Size: 1,422 bytes
 

Contents

Class file image Download
<?
//------------------------------------------------------------------------------------------
// SpamFilter Test
//------------------------------------------------------------------------------------------
include('spamfilter.php');
$sf = new SpamFilter();

$text = 'get lots of xxx pictures in your e-mail!';
if (!
$sf->filter($text)) {
    echo
"'$text' is normal!<br />";
   
$sf->movefrom($text,NORMAL);
}
else echo
"'$text' is spam =)!<br />";

$text = 'Your account information';
if (
$sf->filter($text)) {
    echo
"'$text' is spam!<br />";
   
$sf->movefrom($text,SPAM);
}
else echo
"'$text' is normal =)!<br />";

$text = 'Get free xxx account passwords!';
if (!
$sf->filter($text)) {
    echo
"'$text' is normal!<br />";
   
$sf->movefrom($text,NORMAL);
}
else echo
"'$text' is spam =)!<br />";

$text = 'Hello, my friend!';
if (
$sf->filter($text)) {
    echo
"'$text' is spam!<br />";
   
$sf->movefrom($text,SPAM);
}
else echo
"'$text' is normal =)!<br />";

$text = 'orkut - john has written in your scrap book';
if (
$sf->filter($text)) {
    echo
"'$text' is spam!<br />";
   
$sf->movefrom($text,SPAM);
}
else echo
"'$text' is normal =)!<br />";

$text = 'orkut - mary has written in your scrap book';
if (
$sf->filter($text)) {
    echo
"'$text' is spam!<br />";
   
$sf->movefrom($text,SPAM);
}
else echo
"'$text' is normal =)!<br />";

echo
'<pre>';
var_dump($sf->data);
echo
'</pre>';
?>