[Classifier4j-devel] Simple Implementation
Status: Beta
Brought to you by:
nicklothian
From: Kashif <ks...@ai...> - 2004-07-13 03:15:11
|
Hi I am doing a research on Bayesian filters. I am trying to implement classifier 4J and will appreciate a bit of help. Please note that I am doing a very basic implementation, without using a JDBC Connection. Later I might move on to JDBC and MySQL. Background: I am using searchterm and arrays for my blacklist, whitelist and baylist (ie potential emails for Bayesian Filtering). SearchTerm blackSt = new OrTerm(blackListSearch); SearchTerm whiteSt = new OrTerm(whiteListSearch); SearchTerm baySt = new NotTerm(new OrTerm(blackListSearch)); // If not in BlackList Message[ ] blackMsgs = folder.search(blackSt); Message[ ] whiteMsgs = folder.search(whiteSt); Message[ ] bayMsgs = folder.search(baySt); // These are the messages which I want to filter with bayesian System.out.println("No of messages found in whitelist : " + whiteMsgs.length); System.out.println("No of messages found in blacklist : " + blackMsgs.length); System.out.println(); System.out.println("No of messages ready for bayesian filter : " + bayMsgs.length); //Implementation of Bayesian Classifier 4J IWordsDataSource wds = new SimpleWordsDataSource(); IClassifier classifier = new BayesianClassifier(wds); System.out.println("Matches = " + classifier.classify("This is a sentence") ); Here's the problem: 1) I understand that I have to train the filter, need to know how I can do it. 2) Is it possible to use a flat file (ie text file) rather than jdbc connection |