public static void main(String[] args) throws Exception{
        Scanner keyboard;

        String dictionary = "words.txt";
        String corpus = "enron-skilling.txt";
        String output = "output.txt";

        HashSet<String> wrongWords = new HashSet<String>();

        Trie trie = new Trie();

        if(args.length == 3) {
            dictionary = args[0];
            corpus = args[1];
            output = args[2];
        }
        else if(args.length == 0) {
            System.out.println("The system will using the default setting.");
            System.out.println("java Main words.txt enron-skilling.txt output.txt");
        }
        else {
            System.out.println("usage: java Main [dictionary] [corpus] [output]");
            return;
        }

        keyboard = new Scanner(System.in);

        System.out.println("-----------------------------");
        System.out.println("Welcome to Spelling Correction System!");
        System.out.println("Menu:");
        System.out.println("1. Output the unknown words.");
        System.out.println("2. 2-grams.");
        System.out.println("3. editex.");
        System.out.println("4. edit-distance.");
        System.out.print("\nInput function number:");
        int menuNum = keyboard.nextInt();
        keyboard.nextLine();

        // read the dictionary into a trie
        readDictionary(dictionary, trie);

        NUM_WORDS = readCorpus(trie, corpus, wrongWords);

        long startTime = System.currentTimeMillis();

        if(menuNum == 1) {
            // output the wrong words into a file
            outputWrongWords(wrongWords,output);
        }
        else if(menuNum == 2 ) {
            N_Gram.outputAlternatives(wrongWords,output,dictionary,trie);
        }
        else if(menuNum == 3) {
            Editex.outputAlternatives(wrongWords,output,dictionary,trie);
        }
        else {
            Edit_distance.outputAlternatives(wrongWords,output,dictionary,trie);
        }

        long consumingTime = System.currentTimeMillis() - startTime;
        System.out.println(consumingTime + " ms");
    }