private static void genData(String... args)
            throws Exception
    {
        if (args.length == 0 || args.length == 1 || args.length == 3) {
            File uniDir = (args.length < 3 ? Constants.uniDir : new File(args[0]));
            File triDir = (args.length < 3 ? Constants.triDir : new File(args[1]));
            File outDir = (args.length == 0 ? new File("out"): (args.length < 3 ? new File(args[0]) : new File(args[2])));
            // Print input files.
            System.out.println("Unigram files:");
            printFiles(uniDir.listFiles());
            System.out.println("Trigram files:");
            printFiles(triDir.listFiles());
            System.out.println("Output dir:\n\t" + outDir.getPath());
            // Generate data.
            new gtm.test.stage1.DataGenerator().gen(uniDir, triDir, new File(outDir, "stage1"), "stage1");
            new gtm.test.stage2.DataGenerator().gen(uniDir, triDir, new File(outDir, "stage2"), "stage2");
        } else {
            System.out.println("Generate data for testing.");
            System.out.println("[Usage] gen [uniDir triDir] outDir");
        }
    }