Beispiel #1
0
        private float getBigramProb(int num, int num2)
        {
            NGramBuffer      bigramBuffer     = this.getBigramBuffer(num);
            NGramProbability ngramProbability = bigramBuffer.findNGram(num2);

            return(this.ngramProbTable[1][ngramProbability.getProbabilityID()]);
        }
Beispiel #2
0
        private NGramProbability findNGram(WordSequence wordSequence)
        {
            int num = wordSequence.size();
            NGramProbability result      = null;
            WordSequence     oldest      = wordSequence.getOldest();
            NGramBuffer      ngramBuffer = (NGramBuffer)this.loadedNGramBuffers[num - 1].get(oldest);

            if (ngramBuffer == null)
            {
                ngramBuffer = this.getNGramBuffer(oldest);
                if (ngramBuffer != null)
                {
                    this.loadedNGramBuffers[num - 1].put(oldest, ngramBuffer);
                }
            }
            if (ngramBuffer != null)
            {
                int wordID = this.getWordID(wordSequence.getWord(num - 1));
                result = ngramBuffer.findNGram(wordID);
            }
            return(result);
        }