示例#1
0
 public void loadModel(String file) throws Exception {
   ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
   params.parameters = (double[]) in.readObject();
   pipe.dataAlphabet = (Alphabet) in.readObject();
   pipe.typeAlphabet = (Alphabet) in.readObject();
   in.close();
   pipe.closeAlphabets();
 }
 public void loadModel(InputStream inputStream) throws IOException {
   try {
     ObjectInputStream is = new ObjectInputStream(inputStream);
     params.parameters = (double[]) is.readObject();
     pipe.dataAlphabet = (Alphabet) is.readObject();
     pipe.typeAlphabet = (Alphabet) is.readObject();
     pipe.closeAlphabets();
   } catch (ClassNotFoundException e) {
     IOException e2 = new IOException("Unable to load model: " + e.getMessage());
     e2.initCause(e);
     throw e2;
   }
 }
示例#3
0
  public void loadModel(String file) throws Exception {
    ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
    params.parameters = (double[]) in.readObject();
    pipe.dataAlphabet = (Alphabet) in.readObject();
    pipe.typeAlphabet = (Alphabet) in.readObject();

    // afm 06-04-08
    if (options.separateLab) {
      classifier = (Classifier) in.readObject();
    }

    in.close();
    pipe.closeAlphabets();
  }