public static void main(String[] args) throws Exception {
    // Parse command line flags and arguments
    Map<String, String> argMap = CommandLineUtils.simpleCommandLineParser(args);
    long startTime, endTime;

    // Set up default parameters and settings
    String basePath = "./data/";
    boolean verbose = true;
//    String testMode = "test";
    String testMode = "in-domain";
    int maxTrainLength = 20;
    int maxTestLength = 20;
    String testFileName = "en-web-weblogs-test.sentences";
//    String testFileName = "train50k_len50.2.mrg";
    // Update defaults using command line specifications
    if (argMap.containsKey("-path")) {
      basePath = argMap.get("-path");
      System.out.println("Using base path: " + basePath);
    }
    if (argMap.containsKey("-file")) {
    	testFileName = argMap.get("-file");
        System.out.println("file: " + basePath + testFileName);
    }
    if (argMap.containsKey("-test")) {
      testMode = "test";
      System.out.println("Testing on final test data.");
    } else {
      System.out.println("Testing on dev data.");
    }
    if (argMap.containsKey("-maxTrainLength")) {
      maxTrainLength = Integer.parseInt(argMap.get("-maxTrainLength"));
    }
    System.out.println("Maximum length for training sentences: " + maxTrainLength);
    if (argMap.containsKey("-maxTestLength")) {
      maxTestLength = Integer.parseInt(argMap.get("-maxTestLength"));
    }
    System.out.println("Maximum length for test sentences: " + maxTestLength);
    if (argMap.containsKey("-verbose")) {
      verbose = true;
    }
    if (argMap.containsKey("-quiet")) {
      verbose = false;
    }
    startTime = System.currentTimeMillis();
    System.out.print("Loading training trees ... ");
    List<Tree<String>> trainTrees = readTrees(basePath, 5, 5, maxTrainLength);
//    String filePath = basePath + "train50k_len50.5.mrg";
//    List<Tree<String>> trainTrees = TreeReader.readTreesFromFile(filePath, "(", ")");
    System.out.println("done. (" + trainTrees.size() + " trees)");
    endTime = System.currentTimeMillis();
    System.out.println("time elapsed: "+ (endTime - startTime)/1000);
    startTime = endTime;
    // TODO : Build a better parser!
//    Parser parser = new BaselineParser(trainTrees);
//    Parser parser = new CKYParser2(trainTrees);
    CKYParserK parser = new CKYParserK(trainTrees);
    if (testMode.equalsIgnoreCase("in-domain")) {
    	
      System.out.print("Loading in-domain dev trees ... ");
      List<Tree<String>> testTreesInDomain = readTrees(basePath, 5, 5, maxTestLength);
//      List<Tree<String>> testTreesInDomain = TreeReader.readTreesFromFile(filePath, "(", ")");
      System.out.println("done. (" + testTreesInDomain.size() + " trees)");
      
//      System.out.print("Loading out-of-domain dev trees ... ");
//      List<Tree<String>> testTreesOutOfDomain = readTrees(basePath, 3, 3, maxTestLength);
//      System.out.println("done. (" + testTreesOutOfDomain.size() + " trees)");
      
      System.out.println("Testing in-domain ... ");
      testParser(parser, testTreesInDomain, verbose);
//      testParserK(parser, testTreesInDomain, verbose);
      endTime = System.currentTimeMillis();
      System.out.println("time elapsed = " + (endTime - startTime)/1000);
      
//      startTime = endTime;      
//      System.out.println("Testing out-of-domain ... ");
//      testParser(parser, testTreesOutOfDomain, verbose);
//      endTime = System.currentTimeMillis();
//      System.out.println("time elapsed = " + (endTime - startTime)/1000);
    } 
//    else {
//      System.out.print("Parsing final out-of-domain test data ... ");
//      startTime = System.currentTimeMillis();
//      labelTestSet(basePath, testFileName, parser, verbose);
//      endTime = System.currentTimeMillis();
//      System.out.println("testing,  time elapsed = " + (endTime - startTime)/1000);
//      System.out.println("done.");
//    }
  }