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();