Exemplo n.º 1
0
 private static void _close(System.IDisposable c)
 {
     try
     {
         c.close();
     }
     catch (System.IO.IOException)
     {
     }
 }
Exemplo n.º 2
0
 public static LexicalizedParser loadModelFromZip(String zipFilename,
                                                  String modelName) {
   LexicalizedParser parser = null;
   try {
     File file = new File(zipFilename);
     if (file.exists()) {
       ZipFile zin = new ZipFile(file);
       ZipEntry zentry = zin.getEntry(modelName);
       if (zentry != null) {
         InputStream in = zin.getInputStream(zentry);
         // gunzip it if necessary
         if (modelName.endsWith(".gz")) {
           in = new GZIPInputStream(in);
         }
         ObjectInputStream ois = new ObjectInputStream(in);
         parser = loadModel(ois);
         ois.close();
         in.close();
       }
       zin.close();
     } else {
       throw new FileNotFoundException("Could not find " + modelName +
                                       " inside " + zipFilename);
     }
   } catch (IOException e) {