Esempio n. 1
0
 /** Infer some parameters not given in arguments. */
 protected static void inferParamsNotSet() {
   String tmpFilePath;
   if (gbdArgs.getPath2grobidHome() == null) {
     tmpFilePath = new File("grobid-home").getAbsolutePath();
     System.out.println("No path set for grobid-home. Using: " + tmpFilePath);
     gbdArgs.setPath2grobidHome(tmpFilePath);
     gbdArgs.setPath2grobidProperty(new File("grobid.properties").getAbsolutePath());
   }
 }
Esempio n. 2
0
 /**
  * Process batch given the args.
  *
  * @param pArgs The arguments given to the batch.
  */
 protected static boolean processArgs(final String[] pArgs) {
   boolean result = true;
   if (pArgs.length == 0) {
     System.out.println(getHelp());
     result = false;
   } else {
     String currArg;
     for (int i = 0; i < pArgs.length; i++) {
       currArg = pArgs[i];
       if (currArg.equals("-h")) {
         System.out.println(getHelp());
         result = false;
         break;
       }
       if (currArg.equals("-gH")) {
         gbdArgs.setPath2grobidHome(pArgs[i + 1]);
         if (pArgs[i + 1] != null) {
           gbdArgs.setPath2grobidProperty(getPath2GbdProperties(pArgs[i + 1]));
         }
         i++;
         continue;
       }
       if (currArg.equals("-dIn")) {
         gbdArgs.setPath2Input(pArgs[i + 1]);
         gbdArgs.setPdf(true);
         i++;
         continue;
       }
       if (currArg.equals("-s")) {
         gbdArgs.setInput(pArgs[i + 1]);
         gbdArgs.setPdf(false);
         i++;
         continue;
       }
       if (currArg.equals("-dOut")) {
         gbdArgs.setPath2Output(pArgs[i + 1]);
         i++;
         continue;
       }
       if (currArg.equals("-exe")) {
         final String command = pArgs[i + 1];
         if (availableCommands.contains(command)) {
           gbdArgs.setProcessMethodName(command);
           i++;
           continue;
         } else {
           System.err.println(
               "-exe value should be one value from this list: " + availableCommands);
           result = false;
           break;
         }
       }
     }
   }
   return result;
 }