public static void main(String[] args) throws IOException {
        //map of dataset files
        Map<String, URL> trainingFiles = new HashMap<>();
        URL category = NaiveBayesExample.class.getResource("/category.txt");
        String[] categories = readLines(category);
        for(String each_category : categories)
        {
        	//TODO have a for loop here looping all training files. putting all files belong to one category into
        	//     single file.
        	trainingFiles.put(each_category, NaiveBayesExample.class.getResource("/training.language.en.txt"));
        	trainingFiles.put("French", NaiveBayesExample.class.getResource("/training.language.fr.txt"));
            trainingFiles.put("German", NaiveBayesExample.class.getResource("/training.language.de.txt"));

	        //loading examples in memory
	        Map<String, String[]> trainingExamples = new HashMap<>();
	        for(Map.Entry<String, URL> entry : trainingFiles.entrySet()) {
	            trainingExamples.put(entry.getKey(), readLines(entry.getValue()));
	        }
	        
	        //train classifier
	        NaiveBayes nb = new NaiveBayes();
	        nb.setChisquareCriticalValue(6.63); //0.01 pvalue
	        //at this point, trainingExamples as (category,one_file_content)
	        nb.train(trainingExamples);
	        
	        //get trained classifier knowledgeBase
	        NaiveBayesKnowledgeBase knowledgeBase = nb.getKnowledgeBase();
	        
	        nb = null;
	        trainingExamples = null;
	        
	        
	        //Use classifier
	        nb = new NaiveBayes(knowledgeBase);
	        //TODO change to test files here.
	        String exampleEn = "I am English hello there, can you hear me.";
	        String outputEn = nb.predict(exampleEn);
	        System.out.format("The sentense \"%s\" was classified as \"%s\".%n", exampleEn, outputEn);
	        
	        
	        String exampleEr = "I am Français hello there Je suis are Ich bin Deutsch";
	        String outputEr = nb.predict(exampleEr);
	        System.out.format("The sentense \"%s\" was classified as \"%s\".%n", exampleEr, outputEr);
        }

    }