List of usage examples for opennlp.tools.util.model BaseModel serialize
public final void serialize(Path model) throws IOException
From source file:es.ehu.si.ixa.pipe.nerc.train.InputOutputUtils.java
public static void saveModel(BaseModel trainedModel, String outfile) { OutputStream modelOut = null; try {/*from w w w. j a va 2 s . co m*/ modelOut = new BufferedOutputStream(new FileOutputStream(outfile)); trainedModel.serialize(modelOut); } catch (IOException e) { // Failed to save model e.printStackTrace(); } finally { if (modelOut != null) { try { modelOut.close(); } catch (IOException e) { // Failed to correctly save model. // Written model might be invalid. e.printStackTrace(); } } } }