public static void createNgramsFromFolder(File input_folder, File output_folder, int ngram_value) {
        Stack<File> stack = new Stack<File>();
        stack.push(input_folder);
        while(!stack.isEmpty()) {
        File child = stack.pop();
        if (child.isDirectory()) {
            for(File f : child.listFiles()) stack.push(f);
        } else if (child.isFile()) {
         try{
                System.out.println("Processing: "+child.getAbsolutePath());
                FileReader fr=new FileReader(child.getAbsolutePath());
                FileWriter outputFile = new FileWriter(output_folder+"/file"+file_no);
                BufferedReader br=new BufferedReader(fr);
                String readline = "";
                while((readline = br.readLine())!=null){
                        String[] words = readline.split("\\s+");
                        for(int i=0;i<words.length-ngram_value+1;i++){
                            String ngram="";
                            for(int j=0; j<ngram_value; j++)
                                ngram = ngram+" "+words[i+j];
                            outputFile.write(ngram+"\n");
                        }
                }
                file_no++;
                outputFile.close();
                br.close();
                fr.close();
            }
            catch(Exception e){
                System.out.println("File not found:"+e);
            }
    }
  }
}