Saving a model

Mallet supports a standard method for saving and restoring objects based on serialization.

We simply create a new instance of the ObjectOutputStream class and write the object into a file, as follows:

String modelPath = "myTopicModel"; 
 
//Save model 
ObjectOutputStream oos = new ObjectOutputStream( 
new FileOutputStream (new File(modelPath+".model"))); 
oos.writeObject(model); 
oos.close();    
   
//Save pipeline 
oos = new ObjectOutputStream( 
new FileOutputStream (new File(modelPath+".pipeline"))); 
oos.writeObject(pipeline); 
oos.close(); 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.12.3