Package SevenZip

Examples of SevenZip.LzmaAlone$CommandLine


    try {
      Parser parser = new Parser();
     
      parser.setGroup(group);
      parser.setHelpOption(helpOpt);
      CommandLine cmdLine = parser.parse(args);
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      String inputPath  = (String) cmdLine.getValue(inputDirOpt);
      String outputPath = (String) cmdLine.getValue(outputOpt);
      TrainMaxent trainer = new TrainMaxent();
      trainer.train(inputPath, outputPath);
    }
    catch (OptionException e) {
      log.error("Error while parsing options", e);
View Full Code Here


    try {
      Parser parser = new Parser();
     
      parser.setGroup(group);
      parser.setHelpOption(helpOpt);
      CommandLine cmdLine = parser.parse(args);
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }

      String inputPath  = (String) cmdLine.getValue(inputDirOpt);
      File f = new File(inputPath);
      if (!f.isDirectory()) {
        throw new IllegalArgumentException(f + " is not a directory or does not exit");
      }
      File[] inputFiles = FileUtil.buildFileList(f);
     
      File   modelDir  = new File((String) cmdLine.getValue(modelOpt));
      execute(inputFiles, modelDir);
    } catch (OptionException e) {
      log.error("Error while parsing options", e);
    }
   
View Full Code Here

    try {
      Parser parser = new Parser();
     
      parser.setGroup(group);
      parser.setHelpOption(helpOpt);
      CommandLine cmdLine = parser.parse(args);
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      String classifierType = (String) cmdLine.getValue(typeOpt);

      int gramSize = 1;
      if (cmdLine.hasOption(gramSizeOpt)) {
        gramSize = Integer.parseInt((String) cmdLine.getValue(gramSizeOpt));
      }

      int maxResults = 10;
      if (cmdLine.hasOption(maxResultsOpt)) {
        maxResults = Integer.parseInt((String) cmdLine.getValue(maxResultsOpt));
      }
     
      String inputPath  = (String) cmdLine.getValue(inputDirOpt);
      String modelPath = (String) cmdLine.getValue(modelOpt);
      String categoryField = (String) cmdLine.getValue(categoryFieldOpt);
      String contentField = (String) cmdLine.getValue(contentFieldOpt);
     
      MatchMode mode;
     
      if ("knn".equalsIgnoreCase(classifierType)) {
        mode = MatchMode.KNN;
View Full Code Here

      .create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }

      File inputDir = new File(cmdLine.getValue(inputOpt).toString());
     
      if (!inputDir.isDirectory()) {
        throw new IllegalArgumentException(inputDir + " does not exist or is not a directory");
      }
     
      File categoryFile = new File(cmdLine.getValue(categoryOpt).toString());
     
      if (!categoryFile.isFile()) {
        throw new IllegalArgumentException(categoryFile + " does not exist or is not a directory");
      }
     
      File outputDir = new File(cmdLine.getValue(outputOpt).toString());
     
      outputDir.mkdirs();
     
      if (!outputDir.isDirectory()) {
        throw new IllegalArgumentException(outputDir + " is not a directory or could not be created");
      }

      Collection<String> categoryFields = stringToList(cmdLine.getValue(categoryFieldsOpt).toString());
     
      if (categoryFields.size() < 1) {
        throw new IllegalArgumentException("At least one category field must be spcified.");
      }
     
      Collection<String> textFields = stringToList(cmdLine.getValue(textFieldsOpt).toString());

      if (categoryFields.size() < 1) {
        throw new IllegalArgumentException("At least one text field must be spcified.");
      }
     
      boolean useTermVectors = cmdLine.hasOption(useTermVectorsOpt);
     
      extractTraininingData(inputDir, categoryFile, categoryFields, textFields, outputDir, useTermVectors);
     
    } catch (OptionException e) {
      log.error("Exception", e);
View Full Code Here

         .withOption(testOutputOpt).withOption(trainingDataSizeOpt).withOption(testDataSizeOpt).create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return false;
      }
     
      inputFile = new File((String) cmdLine.getValue(inputFileOpt));
      trainingOutputFile = new File((String) cmdLine.getValue(trainingOutputOpt));
      testOutputFile = new File((String) cmdLine.getValue(testOutputOpt));

      if (cmdLine.hasOption(trainingDataSizeOpt)) {
        trainingDataSize = Integer.parseInt((String) cmdLine.getValue(trainingDataSizeOpt));
      }
     
      if (cmdLine.hasOption(testDataSizeOpt)) {
        testDataSize = Integer.parseInt((String) cmdLine.getValue(testDataSizeOpt));
      }    
     
    } catch (OptionException e) {
      log.error("Command-line option Exception", e);
      CommandLineUtil.printHelp(group);
View Full Code Here

      .withOption(solrUrlOpt).create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return false;
      }
     
      inputFile  = new File((String) cmdLine.getValue(inputFileOpt));
      countFile  = new File((String) cmdLine.getValue(countFileOpt));
      outputFile = new File((String) cmdLine.getValue(outputFileOpt));
      solrUrl    = (String) cmdLine.getValue(solrUrlOpt);
      client     = new TagRecommenderClient(solrUrl);
    } catch (OptionException e) {
      log.error("Command-line option Exception", e);
      CommandLineUtil.printHelp(group);
      return false;
View Full Code Here

   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return false;
      }
     
      inputFile = new File((String) cmdLine.getValue(inputFileOpt));
      countFile = new File((String) cmdLine.getValue(outputFileOpt));

      if (cmdLine.hasOption(limitOpt)) {
        limit = Integer.parseInt((String) cmdLine.getValue(limitOpt));
      }
     
      if (cmdLine.hasOption(cutoffOpt)) {
        cutoff = Integer.parseInt((String) cmdLine.getValue(cutoffOpt));
      }    
     
    } catch (OptionException e) {
      log.error("Command-line option Exception", e);
      CommandLineUtil.printHelp(group);
View Full Code Here

    .create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      File inputFile = new File(cmdLine.getValue(inputOpt).toString());
     
      if (!inputFile.isFile()) {
        throw new IllegalArgumentException(inputFile + " does not exist or is not a file");
      }
     
      File modelDir = new File(cmdLine.getValue(modelOpt).toString());
     
      if (!modelDir.isDirectory()) {
        throw new IllegalArgumentException(modelDir + " does not exist or is not a directory");
      }
     
View Full Code Here

    Group group = gbuilder.withName("Options").withOption(wikipediaFileOpt).withOption(numDocsOpt).withOption(solrURLOpt).withOption(solrBatchOpt).create();

    Parser parser = new Parser();
    parser.setGroup(group);
    CommandLine cmdLine = parser.parse(args);

    File file;
    file = new File(cmdLine.getValue(wikipediaFileOpt).toString());
    File[] dumpFiles;
    if (file.isDirectory()) {
      dumpFiles = file.listFiles(new FilenameFilter() {
        public boolean accept(File file, String s) {
          return s.endsWith(".xml");
        }
      });
    } else {
      dumpFiles = new File[]{file};
    }

    int numDocs = Integer.MAX_VALUE;
    if (cmdLine.hasOption(numDocsOpt)) {
      numDocs = Integer.parseInt(cmdLine.getValue(numDocsOpt).toString());
    }
    String url = DEFAULT_SOLR_URL;
    if (cmdLine.hasOption(solrURLOpt)) {
      url = cmdLine.getValue(solrURLOpt).toString();
    }
    int batch = 100;
    if (cmdLine.hasOption(solrBatchOpt)) {
      batch = Integer.parseInt(cmdLine.getValue(solrBatchOpt).toString());
    }
    WikipediaIndexer indexer = new WikipediaIndexer(new CommonsHttpSolrServer(url));
    int total = 0;
    for (int i = 0; i < dumpFiles.length && total < numDocs; i++) {
      File dumpFile = dumpFiles[i];
View Full Code Here

    try {
      Parser parser = new Parser();
     
      parser.setGroup(group);
      parser.setHelpOption(helpOpt);
      CommandLine cmdLine = parser.parse(args);
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
     
      String classifierType = (String) cmdLine.getValue(typeOpt);
     
      if (cmdLine.hasOption(gramSizeOpt)) {
       
      }
     
      int gramSize = 1;
      if (cmdLine.hasOption(gramSizeOpt)) {
        gramSize = Integer.parseInt((String) cmdLine.getValue(gramSizeOpt));
      }

      int maxResults = 10;
      if (cmdLine.hasOption(maxResultsOpt)) {
        maxResults = Integer.parseInt((String) cmdLine.getValue(maxResultsOpt));
      }
     
      String inputPath  = (String) cmdLine.getValue(inputDirOpt);
      String modelPath = (String) cmdLine.getValue(modelOpt);
      String categoryField = (String) cmdLine.getValue(categoryFieldOpt);
      String contentField = (String) cmdLine.getValue(contentFieldOpt);
     
      MatchMode mode;
     
      if ("knn".equalsIgnoreCase(classifierType)) {
        mode = MatchMode.KNN;
View Full Code Here

TOP

Related Classes of SevenZip.LzmaAlone$CommandLine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.