Package joshua.corpus.lexprob

Examples of joshua.corpus.lexprob.LexicalProbabilities


      // 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();
View Full Code Here

TOP

Related Classes of joshua.corpus.lexprob.LexicalProbabilities

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.