/** * Reads array of language model unigrams * @param count - amount of unigrams according to counts previously read * @return array of language model unigrams, see {@link NgramTrieModel.TrieUnigram} * @throws IOException if reading from stream failed */ public TrieUnigram[] readUnigrams(int count) throws IOException { TrieUnigram[] unigrams = new TrieUnigram[count + 1]; for (int i = 0; i < count + 1; i++) { unigrams[i] = new TrieUnigram(); unigrams[i].prob = Utilities.readLittleEndianFloat(inStream); unigrams[i].backoff = Utilities.readLittleEndianFloat(inStream); unigrams[i].next = Utilities.readLittleEndianInt(inStream); } return unigrams; }
/** * Reads array of language model unigrams * @param count - amount of unigrams according to counts previously read * @return array of language model unigrams, see {@link NgramTrieModel.TrieUnigram} * @throws IOException if reading from stream failed */ public TrieUnigram[] readUnigrams(int count) throws IOException { TrieUnigram[] unigrams = new TrieUnigram[count + 1]; for (int i = 0; i < count + 1; i++) { unigrams[i] = new TrieUnigram(); unigrams[i].prob = Utilities.readLittleEndianFloat(inStream); unigrams[i].backoff = Utilities.readLittleEndianFloat(inStream); unigrams[i].next = Utilities.readLittleEndianInt(inStream); } return unigrams; }