private double computeOverallProbability(SortedSet<TokenProbabilityStrength> tokenProbabilityStrengths,Map<String,Double> workCorpus){
  double p=1.0;
  double np=1.0;
  double tempStrength=0.5;
  int count=MAX_INTERESTING_TOKENS;
  Iterator<TokenProbabilityStrength> iterator=tokenProbabilityStrengths.iterator();
  while ((iterator.hasNext()) && (count-- > 0 || tempStrength >= INTERESTINGNESS_THRESHOLD)) {
    TokenProbabilityStrength tps=iterator.next();
    tempStrength=tps.strength;
    double theDoubleValue=DEFAULT_TOKEN_PROBABILITY;
    Double theDoubleObject=workCorpus.get(tps.token);
    if (theDoubleObject != null) {
      theDoubleValue=theDoubleObject;
    }
    p*=theDoubleValue;
    np*=(1.0 - theDoubleValue);
  }
  return (p / (p + np));
}

private double computeOverallProbability ( SortedSet < TokenProbabilityStrength > tokenProbabilityStrengths , Map < String , Double > workCorpus ) { double p = 1.0 ; double np = 1.0 ; double tempStrength = 0.5 ; int count = MAX_INTERESTING_TOKENS ; Iterator < TokenProbabilityStrength > iterator = tokenProbabilityStrengths . iterator ( ) ; while ( ( iterator . hasNext ( ) ) && ( count -- > 0 || tempStrength >= INTERESTINGNESS_THRESHOLD ) ) { TokenProbabilityStrength tps = iterator . next ( ) ; tempStrength = tps . strength ; double theDoubleValue = DEFAULT_TOKEN_PROBABILITY ; Double theDoubleObject = workCorpus . get ( tps . token ) ; if ( theDoubleObject != null ) { theDoubleValue = theDoubleObject ; } p *= theDoubleValue ; np *= ( 1.0 - theDoubleValue ) ; } return ( p / ( p + np ) ) ; }
compute the spamminess probability of the interesting tokens in the tokenprobabilities sortedset .
