Driver with example data.

@param args
@throws IOException
501873
public static void main(String[] args) throws IOException {
    	String infile = "../example-data/data-lda.txt";
    	String stopwordfile = "../models/stopwords/stopwords.txt";
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new FileInputStream(infile ), "utf8"));

		//		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
//				outfile), enc2));
		StopWords sw = new StopWords(stopwordfile);
		
		LabelAlphabet dict = new LabelAlphabet();
		// words in documents
		ArrayList<TIntArrayList> documentsList= new ArrayList<TIntArrayList>();
		
		
		String line = null;
		while ((line = in.readLine()) != null) {
			line = line.trim();	
			if(line.length()==0)
				continue;
			String[] toks = line.split("\\s+");
			TIntArrayList wordlist = new TIntArrayList(); 
			for(int j=0;j<toks.length;j++){
				String tok = toks[j];
				if(sw.isStopWord(tok))
					continue;
				int idx = dict.lookupIndex(tok);
				wordlist.add(idx);
			}
			documentsList.add(wordlist);
		}
		in.close();
		int[][] documents;
		documents = new int[documentsList.size()][];
		for(int i=0;i<documents.length;i++){
			documents[i] = documentsList.get(i).toArray();
		}
        // vocabulary
        int V = dict.size();
        int M = documents.length;
        // # topics
        int K = 4;
        // good values alpha = 2, beta = .5
        float alpha = 2f;
        float beta = .5f;

        System.out.println("Latent Dirichlet Allocation using Gibbs Sampling.");

        LdaGibbsSampler lda = new LdaGibbsSampler(documents, V);
        lda.configure(10000, 2000, 100, 10);
        lda.gibbs(K, alpha, beta);

        float[][] theta = lda.getTheta();
        float[][] phi = lda.getPhi();

        System.out.println();
        System.out.println();
        System.out.println("Document--Topic Associations, Theta[d][k] (alpha="
            + alpha + ")");
        System.out.print("d\\k\t");
        for (int m = 0; m < theta[0].length; m++) {
            System.out.print("   " + m % 10 + "    ");
        }
        System.out.println();
        for (int m = 0; m < theta.length; m++) {
            System.out.print(m + "\t");
            for (int k = 0; k < theta[m].length; k++) {
                // System.out.print(theta[m][k] + " ");
                System.out.print(shadefloat(theta[m][k], 1) + " ");
            }
            System.out.println();
        }
        System.out.println();
        System.out.println("Topic--Term Associations, Phi[k][w] (beta=" + beta
            + ")");

        System.out.print("k\\w\t");
        for (int w = 0; w < phi[0].length; w++) {
            System.out.print("   " + dict.lookupString(w) + "    ");
        }
        System.out.println();
        for (int k = 0; k < phi.length; k++) {
            System.out.print(k + "\t");
            for (int w = 0; w < phi[k].length; w++) {
            	System.out.print(lnf.format(phi[k][w]) + " ");
//            	System.out.print(phi[k][w] + " ");
//                System.out.print(shadefloat(phi[k][w], 1) + " ");
            }
            System.out.println();
        }
        for (int k = 0; k < phi.length; k++) {
        	int[] top = MyArrays.sort(phi[k]);
        	
            for (int w = 0; w < 10; w++) {
            	System.out.print(dict.lookupString(top[w]) + " ");
            }
            System.out.println();
        }
    }
703402
public static void main(String[] args) {
		Test instance = JKFactory.instance(Test.class);
		System.out.println(instance.hello());
		System.out.println(instance.hello());
		System.out.println(instance.hello());
		System.out.println(instance.hello());

	}
531135
public static void main( String[] args )
            throws IOException
    {
        boolean diff = true;
        boolean minimal = true;
        String outputFile = "out.jardiff";

        for ( int counter = 0; counter < args.length; counter++ )
        {
            // for backward compatibilty with 1.0.1/1.0
            if ( args[counter].equals( "-nonminimal" ) || args[counter].equals( "-n" ) )
            {
                minimal = false;
            }
            else if ( args[counter].equals( "-creatediff" ) || args[counter].equals( "-c" ) )
            {
                diff = true;
            }
            else if ( args[counter].equals( "-applydiff" ) || args[counter].equals( "-a" ) )
            {
                diff = false;
            }
            else if ( args[counter].equals( "-debug" ) || args[counter].equals( "-d" ) )
            {
                _debug = true;
            }
            else if ( args[counter].equals( "-output" ) || args[counter].equals( "-o" ) )
            {
                if ( ++counter < args.length )
                {
                    outputFile = args[counter];
                }
            }
            else if ( args[counter].equals( "-applydiff" ) || args[counter].equals( "-a" ) )
            {
                diff = false;
            }
            else
            {
                if ( ( counter + 2 ) != args.length )
                {
                    showHelp();
                    System.exit( 0 );
                }
                if ( diff )
                {
                    try
                    {
                        OutputStream os = new FileOutputStream( outputFile );

                        JarDiff.createPatch( args[counter], args[counter + 1], os, minimal );
                        os.close();
                    }
                    catch ( IOException ioe )
                    {
                        try
                        {
                            System.out.println( getResources().getString( "jardiff.error.create" ) + " " + ioe );
                        }
                        catch ( MissingResourceException mre )
                        {
                        }
                    }
                }
                else
                {
                    try
                    {
                        OutputStream os = new FileOutputStream( outputFile );

                        new JarDiffPatcher().applyPatch( null, args[counter], args[counter + 1], os );
                        os.close();
                    }
                    catch ( IOException ioe )
                    {
                        try
                        {
                            System.out.println( getResources().getString( "jardiff.error.apply" ) + " " + ioe );
                        }
                        catch ( MissingResourceException mre )
                        {
                        }
                    }
                }
                System.exit( 0 );
            }
        }
        showHelp();
    }
1245536
public static void main(String[] args) {
    if (args.length < 2) {
      System.err.println("Input and output files not provided");
      System.err
          .println("You need to provide both the input serialized java fst model");
      System.err.println("and the output binary openfst model.");
      System.exit(1);
    }

    MutableFst fst = FstInputOutput.readFstFromBinaryResource(args[0]);

    // Serialize the java fst model to disk
    System.out.println("Saving as openfst text model...");
    Convert.export(fst, args[1]);
  }
361921
public static void main(String[] args) {

    try {
      MnistDAO.init("/usr/local/Datasets"); // setup data
    System.out.println("here");
      MnistImageDisplayApp mnistImageDisplayApp = new MnistImageDisplayApp();
      mnistImageDisplayApp.go(args);
    } catch (Exception e) {
      // eat it.
    } finally {
      MnistDAO.release(); // release data resources
    }

  }
1242137
public static void main(String[] args) throws IOException {
    Properties props = new Properties(System.getProperties());
    props.load(JobServerMain.class.getResourceAsStream("system.properties"));
    System.setProperties(props);
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        startServer();
      }
    });
  }
219595
public static void main( String[] args )
    {
        myOut.println( "NanoHTTPD 1.25 (C) 2001,2005-2011 Jarno Elonen and (C) 2010 Konstantinos Togias\n" +
                "(Command line options: [-p port] [-d root-dir] [--licence])\n" );

        // Defaults
        int port = 80;
        File wwwroot = new File(".").getAbsoluteFile();

        // Show licence if requested
        for ( int i=0; i<args.length; ++i )
            if(args[i].equalsIgnoreCase("-p"))
                port = Integer.parseInt( args[i+1] );
            else if(args[i].equalsIgnoreCase("-d"))
                wwwroot = new File( args[i+1] ).getAbsoluteFile();
            else if ( args[i].toLowerCase().endsWith( "licence" ))
            {
                myOut.println( LICENCE + "\n" );
                break;
            }

        try
        {
            new NanoHTTPD( port, wwwroot );
        }
        catch( IOException ioe )
        {
            System.err.println( "Couldn't start server:\n" + ioe );
            System.exit( -1 );
        }

        myOut.println( "Now serving files in port " + port + " from \"" + wwwroot + "\"" );
        myOut.println( "Hit Enter to stop.\n" );

        try { System.in.read(); } catch( Throwable t ) {}
    }
50457
public static void main(String[] arg) {

        bMustExit = true;

        // (ulrivo): read all arguments from the command line
        int i = 0;

        while (i < arg.length) {
            if (arg[i].equalsIgnoreCase("-driver") && (i + 1 < arg.length)) {
                i++;

                defDriver = arg[i];
            } else if (arg[i].equalsIgnoreCase("-url")
                       && (i + 1 < arg.length)) {
                i++;

                defURL = arg[i];
            } else if (arg[i].equalsIgnoreCase("-width")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defWidth = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-height")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defHeight = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-locx")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defLocX = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-locy")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defLocY = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-user")
                       && (i + 1 < arg.length)) {
                i++;

                defUser = arg[i];
            } else if (arg[i].equalsIgnoreCase("-password")
                       && (i + 1 < arg.length)) {
                i++;

                defPassword = arg[i];
            } else if (arg[i].equalsIgnoreCase("-query")
                       && (i + 1 < arg.length)) {
                i++;

                defQuery = arg[i];
            } else if (arg[i].equalsIgnoreCase("-defDirectory")
                       && (i + 1 < arg.length)) {
                i++;

                defDirectory = arg[i];
            } else if (arg[i].equalsIgnoreCase("-database")
                       && (i + 1 < arg.length)) {
                i++;

                defDatabase = arg[i];
            } else {
                showUsage();

                return;
            }

            i++;
        }

        ZaurusDatabaseManager m = new ZaurusDatabaseManager();

        m.main();

        // (ulrivo): make default connection if arguments set via the command line
        Connection c = null;

        if ((defDriver != null && defURL != null) || (defDatabase != null)) {
            if (defDatabase != null) {
                defDriver   = "org.hsqldb_voltpatches.jdbcDriver";
                defURL      = "jdbc:hsqldb:" + defDatabase;
                defUser     = "SA";
                defPassword = "";
            }

            try {
                Class.forName(defDriver).newInstance();

                c = DriverManager.getConnection(defURL, defUser, defPassword);
            } catch (Exception e) {
                System.out.println("No connection for " + defDriver + " at "
                                   + defURL);
                e.printStackTrace();
            }
        } else {
            c = ZaurusConnectionDialog.createConnection(m.fMain, "Connect",
                    new Insets(defWidth, defHeight, defLocX, defLocY));
        }

        if (c == null) {
            return;
        }

        m.connect(c);
    }
132396
public static void main(String... argv) throws IOException {
    run(System.out, argv);
    System.out.println();
  }
1341302
public static void main(String[] args) {
    SparkSession spark = SparkSession
      .builder()
      .appName("Java Spark SQL data sources example")
      .config("spark.some.config.option", "some-value")
      .getOrCreate();

    runBasicDataSourceExample(spark);
    runBasicParquetExample(spark);
    runParquetSchemaMergingExample(spark);
    runJsonDatasetExample(spark);
    runJdbcDatasetExample(spark);

    spark.stop();
  }
759247
public static void main(final String[] args) throws BindException, InjectionException {
    final int tcpBeginPort = args.length > 0 ? Integer.parseInt(args[0]) : DEFAULT_TCP_BEGIN_PORT;
    final int tcpRangeCount = args.length > 1 ? Integer.parseInt(args[1]) : DEFAULT_TCP_RANGE_COUNT;
    final int tcpTryCount = args.length > 2 ? Integer.parseInt(args[2]) : DEFAULT_TCP_RANGE_TRY_COUNT;

    final Configuration runtimeConf = getRuntimeConfiguration(tcpBeginPort, tcpRangeCount, tcpTryCount);
    final Configuration driverConf = getDriverConfiguration();

    final LauncherStatus status = DriverLauncher
        .getLauncher(runtimeConf)
        .run(driverConf, JOB_TIMEOUT);
    LOG.log(Level.INFO, "REEF job completed: {0}", status);
  }
220691
@SuppressWarnings("squid:S1166")
    public static void main(String[] args) throws IOException {
        opts = new Options();

        // Parse the cmdline arguments
        CmdLineParser cli = new CmdLineParser(opts);
        try {
            cli.getProperties().withUsageWidth(80);
            cli.parseArgument(args);
        } catch (@SuppressWarnings("unused") CmdLineException ex) {
            cli.printUsage(System.err);
            System.exit(1);
        }

        Runtime runtime = Runtime.getRuntime();
        int mb = 1024 * 1024;
        out(1, "Total Memory: %d%n", runtime.totalMemory() / mb);
        out(1, "Max Memory: %d%n", runtime.maxMemory() / mb);

        Parameters ps = opts.parameters();

        Iterator<LabelledInstance> ite = opts.instances().iterator();
        while (ite.hasNext()) {
            LabelledInstance i = ite.next();
            solve(i, ps);
        }
    }
332771
public static void main(String [] args){
        if (args.length != 2){
            displayHelp();
            return;
        }
        
        //Read the input data
        try{
            String option = args[0];
            if (option.equalsIgnoreCase("-inputfile")){
                BufferedReader in = new BufferedReader(
                        new InputStreamReader(new FileInputStream(args[1]), "UTF-8"));
                BufferedWriter out = new BufferedWriter(
                        new OutputStreamWriter(new FileOutputStream(args[1] + ".tkn") , "UTF-8"));

                String line = "";
                while ((line = in.readLine()) != null){                
                    out.write(PennTokenizer.tokenize(line));
                    out.write("\n");
                }
                
                in.close();
                out.close();
            }
            
            else if (option.equalsIgnoreCase("-inputdir")){
                System.out.println("Tokenize input");
                //segment only files ends with .sent
                File inputDir = new File(args[1]);
                File [] childrent = inputDir.listFiles(new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                        return name.endsWith(".sent");
                    }
                });
                
                for (int i = 0; i < childrent.length; ++i){                    
                    BufferedReader in = new BufferedReader(
                            new InputStreamReader(new FileInputStream(childrent[i]), "UTF-8"));
                    BufferedWriter out = new BufferedWriter(
                            new OutputStreamWriter(new FileOutputStream(childrent[i] + ".tkn") , "UTF-8"));

                    String line = "";
                    while ((line = in.readLine()) != null){                
                        out.write(PennTokenizer.tokenize(line));
                        out.write("\n");
                    }

                    in.close();
                    out.close();    
                }
            }           
        } catch (Exception e){
            System.out.println("Error:" + e.getMessage());
        }
    }
290382
public static void main(String[] args) throws IOException
    {
        process_command_line(args);

        info = new JarInfo();

        if (printVersion) {
            doPrintVersion();
        }
        if (printHelp) {
            doPrintHelp();
        }
    }
1295921
public static void main(String[] args) throws IOException {
    if (!parseInputArgs(args)) {
      usage();
      System.exit(EXIT_FAILED);
    }
    if (sHelp) {
      usage();
      System.exit(EXIT_SUCCEEDED);
    }

    dumpJournal();
  }
746886
public static void main(String[] args) throws Exception {

		prepareTestDb();
		JDBCExample tut = new JDBCExample();
		JobExecutionResult res = LocalExecutor.execute(tut, args);
		System.out.println("runtime: " + res.getNetRuntime());

		System.exit(0);
	}
991140
public static void main(String[] args) throws IOException {
//        Control c = new Control();
//        c.process(args);
        String cmd = "test jsjs {1} {0} ksksks {2}";
        System.out.println(MessageFormat.format(cmd, 1, 2, "test"));
    }