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

		/**
		 * 分析命令参数
		 */
		Options opt = new Options();

		opt.addOption("path", true, "保存路径");
		opt.addOption("res", true, "评测结果保存路径");
		opt.addOption("slot", true, "槽大小");

		BasicParser parser = new BasicParser();
		CommandLine cl;
		try {
			cl = parser.parse(opt, args);
		} catch (Exception e) {
			System.err.println("Parameters format error");
			return;
		}

		int slotsize = Integer.parseInt(cl.getOptionValue("slot", "50"));
		System.out.println("槽大小:"+slotsize);

		String file = cl.getOptionValue("path", "./tmp/news.allsites.txt");
		System.out.println("数据路径:"+file);

		String resfile = cl.getOptionValue("res", "./tmp/res.txt");
		System.out.println("测试结果:"+resfile);


		SougouCA sca = new SougouCA(file);

		WordCluster wc = new WordCluster();
		wc.slotsize = slotsize;
		wc.read(sca);

		wc.startClustering();
		wc.saveModel(resfile+".m");
		wc.saveTxt(resfile);		
		wc = WordCluster.loadFrom(resfile+".m");
		wc.saveTxt(resfile+"1");
		System.out.println(new Date().toString());
		System.out.println("Done");
	}
public static void main ( String [ ] args ) throws Exception { Options opt = new Options ( ) ; opt . addOption ( "path" , true , "保存路径" ) ; opt . addOption ( "res" , true , "评测结果保存路径" ) ; opt . addOption ( "slot" , true , "槽大小" ) ; BasicParser parser = new BasicParser ( ) ; CommandLine cl ; try { cl = parser . parse ( opt , args ) ; } catch ( Exception e ) { System . err . println ( "Parameters format error" ) ; return ; } int slotsize = Integer . parseInt ( cl . getOptionValue ( "slot" , "50" ) ) ; System . out . println ( "槽大小:" + slotsize ) ; String file = cl . getOptionValue ( "path" , "./tmp/news.allsites.txt" ) ; System . out . println ( "数据路径:" + file ) ; String resfile = cl . getOptionValue ( "res" , "./tmp/res.txt" ) ; System . out . println ( "测试结果:" + resfile ) ; SougouCA sca = new SougouCA ( file ) ; WordCluster wc = new WordCluster ( ) ; wc . slotsize = slotsize ; wc . read ( sca ) ; wc . startClustering ( ) ; wc . saveModel ( resfile + ".m" ) ; wc . saveTxt ( resfile ) ; wc = WordCluster . loadFrom ( resfile + ".m" ) ; wc . saveTxt ( resfile + "1" ) ; System . out . println ( new Date ( ) . toString ( ) ) ; System . out . println ( "Done" ) ; }
@param args
@throws Exception