public function getWordicity($wordTotalCount, $wordProbability, $wordInverseProbability)
{
$denominator = $wordProbability + $wordInverseProbability;
/**
* Bayes Theorem using the above parameters
*
* the probability that this document is a particular LABEL
* given that a particular WORD is in it
*
*/
$wordicity = $wordProbability / $denominator;
/*
* here 0.5 is the weight, higher training data in the db means higher weight
*/
$wordicity = (10 * 0.5 + $wordTotalCount * $wordicity) / (10 + $wordTotalCount);
if ($wordicity == 0) {
$wordicity = 0.01;
} else {
if ($wordicity == 1) {
$wordicity = 0.99;
}
}
return $wordicity;
}