示例#1
0
 /** analyze arguments to APFtoXML. */
 public static void init(String[] args) throws IOException {
   if (args.length == 0) argErr();
   JetTest.encoding = "UTF-8";
   year = args[0];
   AceDocument.ace2004 = false;
   AceDocument.ace2005 = false;
   int requiredArgs = 6;
   if (year.equals("2002")) {
   } else if (year.equals("2003")) {
   } else if (year.equals("2004")) {
     requiredArgs = 8;
     String gazFile = args[6];
     String preDict = args[7];
     gazetteer = new Gazetteer();
     gazetteer.load(gazFile);
     loadPreDict(preDict);
     AceDocument.ace2004 = true;
   } else if (year.equals("2005")) {
     AceDocument.ace2004 = true;
     AceDocument.ace2005 = true;
   } else {
     System.err.println("Invalid year:  must be 2002-2005");
     System.exit(1);
   }
   if (args.length <= requiredArgs) argErr();
   ACEdir = args[1];
   if (!ACEdir.endsWith("/")) ACEdir += "/";
   outputDir = args[2];
   if (!outputDir.endsWith("/")) outputDir += "/";
   fileList = args[3];
   apfExtension = args[4];
   outputExtension = args[5];
   for (int i = requiredArgs; i < args.length; i++) setFlag(args[i]);
 }