Skip to content

A spam filter implemented with Bayers Method.

License

Notifications You must be signed in to change notification settings

Dreamer-hxs/Anti-spam

 
 

Repository files navigation

Anti-Spam

A spam filter implemented with Bayes Method. Library

  • Mysql connection tool connect database via JDBC in Anti-Spa/lib
  • jcseg segments Chinese words
  • Tomcat on which this system runs

Bayes Method

  • Bayes Method in Spam Detection : In this formula , S = "a spam", w = "a specific word showing in the mail" , N = "a normal email".

  • An email certainly contains more than one word :

  • Consider comprehensively, calculate combining probability( Here we assume that are independent) :
  • Further more,we assume , so the formula above can be simplified as:
  • I'm using this formula to detect emails in the program.

Here are more details of spam filtering ,fundamental knowledge of Combining Probability and Bayes theorem.

How To Use

  • You need firstly include all the libs above to compile this program.Yet if you only uses in Tomcat, mysql connection tool and jcseg are already included in /Anti-Spam/WEB-INF/lib path on Tomcat.

  • webapps files of Tomcat are in '/webapps',copy '/webapps/Anti-Spam' folder to $TomcatPath/webapps/ of your Tomcat Installation Path.(attention, /webapps may not be the latest version)

  • Before you use it,create a file named 'sqlInfo.ini'(file name defined in org.bit.util.GlobalConstants.java),in which all init infomation is defined.Here are some necessary items.

      url = jdbc:mysql://localhost:3306/test
      user = langley
      password = 123456
      jcsegPropPath = /Anti-Spam/WEB-INF/lib/jcseg.properties #or use absolute path
    
  • Run in Tomcat.

About

A spam filter implemented with Bayers Method.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 97.1%
  • HTML 2.9%