public static void main(String[] args) throws FrameworkException { TwitterFramework framework = new TwitterFramework(); Parameters p = new Parameters(); // add source p.add("InputFileName", "data/footballMuteButton/nfc10k.txt"); framework.addSource(new SimpleTweetReaderSource(), p); // add services p.add("StopFileName", "data/stop_words.txt"); framework.addService(new StopWordRemover(), p); p.add("SimpleGroundTruthFileName", "data/footballMuteButton/nfcMarked.txt"); framework.addService(new SimpleGroundTruth(), p); framework.addService(new ScoreParser(), p); framework.addService(new ScoreFilter(), p); framework.addService(new FilteredTweetsListCreator(), p); framework.addService(new TweetListSorter(), p); framework.addService(new FilterComparer(), p); p.add("FilterStatisticsFileName", "data/exampleFiles/filterStatsExample.out"); p.add("StatisticsTitle", "Score Filter Only"); p.add("WriteMode", WriteMode.APPEND); framework.addWriter(new FilterStatisticsWriter(), p); // run framework framework.mainLoop(); }
public static void main(String[] args) throws FrameworkException { TwitterFramework framework = new TwitterFramework(); Parameters p = new Parameters(); BayesianFilter bayesianFilter = new BayesianFilter(); // learning stage // add source p.add("InputFileName", "analysis/files/bayesian/spamLearning.txt"); framework.addSource(new SimpleTweetReaderSource(), p); // learning spam stage p.add("StopFileName", "data/stop_words.txt"); framework.addService(new StopWordRemover(), p); p.add("BayesianBagMode", BayesianBagMode.STATIC); p.add("BayesianFilterMode", BayesianFilterMode.LEARNING_SPAM); p.add("MinAppearances", 1); p.add("SingleThreshold", 0.8); p.add("CombinedThreshold", 0.7); framework.addService(bayesianFilter, p); framework.mainLoop(); // learning ham stage framework.clearServices(); p.add("InputFileName", "analysis/files/bayesian/hamLearning.txt"); p.add("StopFileName", "data/stop_words.txt"); framework.addService(new StopWordRemover(), p); p.add("BayesianFilterMode", BayesianFilterMode.LEARNING_HAM); framework.addService(bayesianFilter, p); framework.mainLoop(); // add services (filter stage) framework.clearServices(); p.add("InputFileName", "analysis/files/bayesian/bayesianTestFile.txt"); p.add("StopFileName", "data/stop_words.txt"); framework.addService(new StopWordRemover(), p); p.add("BayesianFilterMode", BayesianFilterMode.FILTERING); framework.addService(bayesianFilter, p); p.add("SimpleGroundTruthFileName", "analysis/files/bayesian/spamNotLearning.txt"); framework.addService(new SimpleGroundTruth(), p); framework.addService(new FilteredTweetsListCreator(), p); framework.addService(new TweetListSorter(), p); framework.addService(new FilterComparer(), p); framework.addService( new Utilities.PrintLatexStatisticsTable( "Bayesian Filter statistics", "bayesianFilterStatistics"), p); // add writer p.add("WriteMode", WriteMode.OVERWRITE); p.add("BayesianFilterOutputFileName", "analysis/files/bayesian/spamWordList.out"); framework.addWriter(new BayesianFilterSpamWordWriter(), p); // run framework framework.mainLoop(); }