// Write lexprobs to disk
{
ParallelCorpus parallelCorpus = new AlignedParallelCorpus(sourceCorpusArray, targetCorpusArray, grids);
if (logger.isLoggable(Level.INFO)) logger.info("Constructing lexprob table");
LexicalProbabilities lexProbs =
new LexProbs(parallelCorpus, Float.MIN_VALUE);
String lexprobsFilename = outputDirName + File.separator + "lexprobs.txt";
FileOutputStream stream = new FileOutputStream(lexprobsFilename);
OutputStreamWriter lexprobsOut = new OutputStreamWriter(stream, charset);
String binaryLexCountFilename = outputDirName + File.separator + "lexicon.counts";
if (logger.isLoggable(Level.INFO)) logger.info("Writing binary lexicon counts to disk at " + binaryLexCountFilename);
// BinaryOut lexCountOut = new BinaryOut(binaryLexCountFilename);
ObjectOutput lexCountOut = new ObjectOutputStream(new FileOutputStream(binaryLexCountFilename));
lexProbs.writeExternal(lexCountOut);
lexCountOut.close();
String s = lexProbs.toString();
if (logger.isLoggable(Level.INFO)) logger.info("Writing lexprobs at " + lexprobsFilename);
lexprobsOut.write(s);
lexprobsOut.flush();
lexprobsOut.close();