/**
  * -- Add function info here --
  */
 function getFarthestToken($blogId, $tokens)
 {
     $bayesianTokens = new BayesianTokens();
     $tokens = $bayesianTokens->getBayesianTokensFromArray($blogId, $tokens, false);
     $tempArray = array();
     foreach ($tokens as $token) {
         array_push($tempArray, abs($token->getProb() - 0.5));
     }
     arsort($tempArray);
     $keys = array_keys($tempArray);
     $key = $keys[0];
     return $tokens[$key];
 }
 /**
  * @private
  */
 function _getMostSignificantTokens($blogId, $tokens)
 {
     $config =& Config::getConfig();
     $bayesianFilterInfos = new BayesianFilterInfos();
     $bayesianFilterInfo = $bayesianFilterInfos->getBlogBayesianFilterInfo($blogId);
     $totalSpam = $bayesianFilterInfo->getTotalSpam();
     $totalNonSpam = $bayesianFilterInfo->getTotalNonSpam();
     $bayesianTokens = new BayesianTokens();
     foreach ($tokens as $token) {
         $bayesianTokens->updateOccurrences($blogId, $token, 0, 0, $totalSpam, $totalNonSpam, false);
     }
     $tokens = $bayesianTokens->getBayesianTokensFromArray($blogId, $tokens);
     $tempArray = array();
     foreach ($tokens as $token) {
         if ($token->isSignificant() && $token->isValid()) {
             array_push($tempArray, abs($token->getProb() - 0.5));
         }
     }
     arsort($tempArray);
     $significantTokens = array();
     $count = 0;
     foreach ($tempArray as $key => $value) {
         array_push($significantTokens, $tokens[$key]);
         $count++;
         if ($count == $config->getValue("bayesian_filter_number_significant_tokens")) {
             break;
         }
     }
     return $significantTokens;
 }