example/com/chenlb/mmseg4j/example/Effect.java
public static void main(String[] args) throws Exception {
		int n = 1;
		if(args.length < 1) {
			usage();
			return;
		}
		Properties analyzers = new Properties();
		analyzers.load(new FileInputStream(new File("analyzer.properties")));
		String mode = System.getProperty("mode", "complex");
		String a = System.getProperty("analyzer", "mmseg4j");
		Analyzer analyzer = null;
		String an = (String) analyzers.get(a);
		if(an != null) {
			analyzer = (Analyzer)Class.forName(an).newInstance();
			mode = a;
		} else {
			usage();
			return;
		}
		if(args.length > 1) {
			try {
				n = Integer.parseInt(args[1]);
			} catch (NumberFormatException e) {
				
			}
		}
		File path = new File(args[0]);
		System.out.println("analyzer="+analyzer.getClass().getName());
		Effect ef = new Effect(path, analyzer);
		ef.run(mode, n);
	}
public static void main(String[] args) throws Exception {
		int n = 1;
		if(args.length < 1) {
			usage();
			return;
		}
		Properties analyzers = new Properties();
		analyzers.load(new FileInputStream(new File("analyzer.properties")));
		String mode = System.getProperty("mode", "complex");
		String a = System.getProperty("analyzer", "mmseg4j");
		Analyzer analyzer = null;
		String an = (String) analyzers.get(a);
		if(an != null) {
			analyzer = (Analyzer)Class.forName(an).newInstance();
			mode = a;
		} else {
			usage();
			return;
		}
		if(args.length > 1) {
			try {
				n = Integer.parseInt(args[1]);
			} catch (NumberFormatException e) {
				
			}
		}
		File path = new File(args[0]);
		System.out.println("analyzer="+analyzer.getClass().getName());
		Effect ef = new Effect(path, analyzer);
		ef.run(mode, n);
	}
public static void main ( String [ ] args ) throws Exception { int n = 1 ; if ( args . length < 1 ) { usage ( ) ; return ; } Properties analyzers = new Properties ( ) ; analyzers . load ( new FileInputStream ( new File ( "analyzer.properties" ) ) ) ; String mode = System . getProperty ( "mode" , "complex" ) ; String a = System . getProperty ( "analyzer" , "mmseg4j" ) ; Analyzer analyzer = null ; String an = ( String ) analyzers . get ( a ) ; if ( an != null ) { analyzer = ( Analyzer ) Class . forName ( an ) . newInstance ( ) ; mode = a ; } else { usage ( ) ; return ; } if ( args . length > 1 ) { try { n = Integer . parseInt ( args [ 1 ] ) ; } catch ( NumberFormatException e ) { } } File path = new File ( args [ 0 ] ) ; System . out . println ( "analyzer=" + analyzer . getClass ( ) . getName ( ) ) ; Effect ef = new Effect ( path , analyzer ) ; ef . run ( mode , n ) ; }
-Dmode=simple, default is complex
@param args args[0] txt path
@author chenlb 2009-3-28 下午02:19:52
@throws Exception
- Dmode = simple default is complex