private void loadFiles() throws IOException {
    File rawDir = new File(ioConf.getRawDir());

    if (!rawDir.exists() || !rawDir.isDirectory()) {
      throw new IOException(rawDir.getAbsolutePath() + " is not a valid directory");
    }

    Doc doc;
    File parentDir;
    File anotFile;
    for (File d : rawDir.listFiles()) {
      if (d.isDirectory()) {
        for (File f : d.listFiles()) {
          doc = XMLDoc.readXML(f);

          parentDir = new File(ioConf.getParsedDir(), doc.getParentDirName());
          anotFile = new File(parentDir, doc.getAnotFileName());
          doc.anotFile = anotFile;

          documents.add(doc);

          // addAnnotation(doc);
        }
      }
    }
  }
 public void addAnnotation(Doc doc) throws IOException {
   File parentDir = new File(ioConf.getParsedDir(), doc.getParentDirName());
   File anotFile = new File(parentDir, doc.getAnotFileName());
   if (!anotFile.exists()) {
     System.err.println("Generating annotation for " + doc.f.getName());
     genAnnotation(doc);
     saveAnnotation(doc, anotFile);
   } else {
     try {
       doc.setAno(ParsedDocReader.read(anotFile));
     } catch (IOException e) {
       System.err.println("Generating annotation for " + doc.f.getName());
       genAnnotation(doc);
     }
   }
 }
  private Map<Doc, String[]> linkModels() {
    // Mapping of doc names to models
    Map<Doc, String[]> map = new HashMap<Doc, String[]>();

    File modelDir = new File(ioConf.getModelDir());

    String prefix, suffix;
    for (Doc d : documents) {
      // Set model prefix/suffix
      prefix = d.getParentDirName();
      prefix = prefix.substring(0, prefix.length() - 1).toUpperCase();

      suffix = d.f.getName();
      suffix = suffix.substring(suffix.lastIndexOf(".") + 1);

      // Add doc/models to the map
      map.put(d, modelDir.list(new ModelFileFilter(prefix, suffix)));
    }
    return map;
  }