/** * Returns the word ID of the nth follower, assuming that the ID is the first two bytes of the NGram entry. * * @param nthFollower starts from 0 to (numberFollowers - 1). * @return the word ID */ public final int getWordID(int nthFollower) { int nthPosition = nthFollower * (buffer.length / numberNGrams); setPosition(nthPosition); return readBytesAsInt(); }
/** * Returns the NGramProbability of the nth follower. * * @param nthFollower which follower * @return the NGramProbability of the nth follower */ public int getProbabilityID(int nthFollower) { int nthPosition = 0; nthPosition = nthFollower * LargeNGramModel.BYTES_PER_NGRAM * ((is32bits) ? 4 : 2); setPosition(nthPosition + ((is32bits) ? 4 : 2)); // to skip the word ID return readBytesAsInt(); }
/** * Returns the NGramProbability of the nth follower. * * @param nthFollower which follower * @return the NGramProbability of the nth follower */ public NGramProbability getNGramProbability(int nthFollower) { int nthPosition = 0, wordID = 0, probID = 0, backoffID = 0, firstNGram = 0; nthPosition = nthFollower * LargeNGramModel.BYTES_PER_NGRAM * ((is32bits) ? 4 : 2); setPosition(nthPosition); wordID = readBytesAsInt(); probID = readBytesAsInt(); backoffID = readBytesAsInt(); firstNGram = readBytesAsInt(); return (new NGramProbability(nthFollower, wordID, probID, backoffID, firstNGram)); } }
/** * Returns the NGramProbability of the nth follower. * * @param nthFollower which follower * @return the NGramProbability of the nth follower */ public int getProbabilityID(int nthFollower) { int nthPosition = 0; nthPosition = nthFollower * LargeNGramModel.BYTES_PER_NGRAM * ((is32bits) ? 4 : 2); setPosition(nthPosition + ((is32bits) ? 4 : 2)); // to skip the word ID return readBytesAsInt(); }
/** * Returns the word ID of the nth follower, assuming that the ID is the first two bytes of the NGram entry. * * @param nthFollower starts from 0 to (numberFollowers - 1). * @return the word ID */ public final int getWordID(int nthFollower) { int nthPosition = nthFollower * (buffer.length / numberNGrams); setPosition(nthPosition); return readBytesAsInt(); }
/** * Returns the NGramProbability of the nth follower. * * @param nthFollower which follower * @return the NGramProbability of the nth follower */ public NGramProbability getNGramProbability(int nthFollower) { int nthPosition = 0, wordID = 0, probID = 0, backoffID = 0, firstNGram = 0; nthPosition = nthFollower * LargeNGramModel.BYTES_PER_NGRAM * ((is32bits) ? 4 : 2); setPosition(nthPosition); wordID = readBytesAsInt(); probID = readBytesAsInt(); backoffID = readBytesAsInt(); firstNGram = readBytesAsInt(); return (new NGramProbability(nthFollower, wordID, probID, backoffID, firstNGram)); } }