public Element writeModel() throws Exception {
Element root = new Element("memm");
for(String prev : gmByPrev.keySet()) {
Element maxent = new Element("maxent");
maxent.addAttribute(new Attribute("prev", prev));
StringGISModelWriter sgmw = new StringGISModelWriter(gmByPrev.get(prev));
sgmw.persist();
maxent.appendChild(sgmw.toString());
root.appendChild(maxent);
}
if(rescorer != null) {
root.appendChild(rescorer.writeElement());
}