+
+ /**
+ * A convenience method to create a temporary file that is deleted on exit of
+ * the JVM
+ *
+ * @param prefix
+ * @param suffix
+ * @return
+ * @throws IOException
+ */
+ protected File createTempFile(String prefix, String suffix)
+ throws IOException
+ {
+ File f = File.createTempFile(prefix, suffix);
+ f.deleteOnExit();
+ return f;
+
+ }
+
+ /**
+ * Exports an HMM to the specified file
+ *
+ * @param hmm
+ * @param hmmFile
+ * @throws IOException
+ */
+ public void exportHmm(HiddenMarkovModel hmm, File hmmFile)
+ throws IOException
+ {
+ if (hmm != null)
+ {
+ HMMFile file = new HMMFile(hmm);
+ PrintWriter writer = new PrintWriter(hmmFile);
+ writer.print(file.print());
+ writer.close();
+ }
+ }