public StateProbPair probRule(long[] words,LmPool poolWrapper){
  poolWrapper.setBufferLength(words.length);
  for (int i=0; i < words.length; i++) {
    poolWrapper.writeIdToBuffer(i,words[i]);
  }
  long packedResult=probRule(pointer,poolWrapper.getPool());
  int state=(int)(packedResult >> 32);
  float probVal=Float.intBitsToFloat((int)packedResult);
  return new StateProbPair(state,probVal);
}

public StateProbPair probRule ( long [ ] words , LmPool poolWrapper ) { poolWrapper . setBufferLength ( words . length ) ; for ( int i = 0 ; i < words . length ; i ++ ) { poolWrapper . writeIdToBuffer ( i , words [ i ] ) ; } long packedResult = probRule ( pointer , poolWrapper . getPool ( ) ) ; int state = ( int ) ( packedResult > > 32 ) ; float probVal = Float . intBitsToFloat ( ( int ) packedResult ) ; return new StateProbPair ( state , probVal ) ; }
this function is the bridge to the interface in kenlm / lm / left . hh , which has kenlm score the whole rule . it takes an array of words and states retrieved from tail nodes ( nonterminals in the rule ) . nonterminals have a negative value so kenlm can distinguish them . the sentence number is needed so kenlm knows which memory pool to use . when finished , it returns the updated kenlm state and the lm probability incurred along this rule .
