Add a minimum data threshold to CharDistributionAnalysis::GetConfidence() to reduce false positives. Bug 306272, r=jshin, sr=rbs

This commit is contained in:
smontagu%smontagu.org 2006-08-08 10:35:30 +00:00
parent 816d9cf6b1
commit 3e78aa2e92

View File

@ -46,11 +46,15 @@
#define SURE_YES 0.99f
#define SURE_NO 0.01f
#define MINIMUM_DATA_THRESHOLD 4
//return confidence base on received data
float CharDistributionAnalysis::GetConfidence()
{
//if we didn't receive any character in our consideration range, return negative answer
if (mTotalChars <= 0)
//if we didn't receive any character in our consideration range, or the
// number of frequent characters is below the minimum threshold, return
// negative answer
if (mTotalChars <= 0 || mFreqChars <= MINIMUM_DATA_THRESHOLD)
return SURE_NO;
if (mTotalChars != mFreqChars) {