freqOfWordInDoc = (int)inst.valueSparse(i); totalWords += freqOfWordInDoc;
freqOfWordInDoc = inst.valueSparse(i);
  private double probOfDocGivenClass(Instance inst, int classIndex)  {    double answer = 0;    int totalWords = 0;	    int freqOfWordInDoc;    for(int i = 0; i<inst.numValues(); i++)      if(inst.index(i) != inst.classIndex())	{	  freqOfWordInDoc = (int)inst.valueSparse(i);	  totalWords += freqOfWordInDoc;	  answer += (freqOfWordInDoc * probOfWordGivenClass[classIndex][inst.index(i)] 		     ); //- lnFactorial(freqOfWordInDoc));	}	    //answer += lnFactorial(totalWords);//The factorial terms don't make     //any difference to the classifier's    //accuracy, so not needed.	    return answer;  }