Bug 780979 - Compute length of char to freq order tables. r=smontagu

This commit is contained in:
Andrew McCreight 2012-08-29 06:48:15 -07:00
parent 0c5fa1f0c9
commit cc987a78b8
6 changed files with 11 additions and 22 deletions

View File

@ -22,10 +22,7 @@
#define BIG5_TYPICAL_DISTRIBUTION_RATIO (float)0.75
//Char to FreqOrder table ,
#define BIG5_TABLE_SIZE 5376
// Char to FreqOrder table
static const int16_t Big5CharToFreqOrder[] =
{
1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, // 16

View File

@ -10,6 +10,7 @@
#include "EUCKRFreq.tab"
#include "EUCTWFreq.tab"
#include "GB2312Freq.tab"
#include "nsMemory.h"
#define SURE_YES 0.99f
#define SURE_NO 0.01f
@ -36,42 +37,42 @@ float CharDistributionAnalysis::GetConfidence(void)
EUCTWDistributionAnalysis::EUCTWDistributionAnalysis()
{
mCharToFreqOrder = EUCTWCharToFreqOrder;
mTableSize = EUCTW_TABLE_SIZE;
mTableSize = NS_ARRAY_LENGTH(EUCTWCharToFreqOrder);
mTypicalDistributionRatio = EUCTW_TYPICAL_DISTRIBUTION_RATIO;
}
EUCKRDistributionAnalysis::EUCKRDistributionAnalysis()
{
mCharToFreqOrder = EUCKRCharToFreqOrder;
mTableSize = EUCKR_TABLE_SIZE;
mTableSize = NS_ARRAY_LENGTH(EUCKRCharToFreqOrder);
mTypicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO;
}
GB2312DistributionAnalysis::GB2312DistributionAnalysis()
{
mCharToFreqOrder = GB2312CharToFreqOrder;
mTableSize = GB2312_TABLE_SIZE;
mTableSize = NS_ARRAY_LENGTH(GB2312CharToFreqOrder);
mTypicalDistributionRatio = GB2312_TYPICAL_DISTRIBUTION_RATIO;
}
Big5DistributionAnalysis::Big5DistributionAnalysis()
{
mCharToFreqOrder = Big5CharToFreqOrder;
mTableSize = BIG5_TABLE_SIZE;
mTableSize = NS_ARRAY_LENGTH(Big5CharToFreqOrder);
mTypicalDistributionRatio = BIG5_TYPICAL_DISTRIBUTION_RATIO;
}
SJISDistributionAnalysis::SJISDistributionAnalysis()
{
mCharToFreqOrder = JISCharToFreqOrder;
mTableSize = JIS_TABLE_SIZE;
mTableSize = NS_ARRAY_LENGTH(JISCharToFreqOrder);
mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO;
}
EUCJPDistributionAnalysis::EUCJPDistributionAnalysis()
{
mCharToFreqOrder = JISCharToFreqOrder;
mTableSize = JIS_TABLE_SIZE;
mTableSize = NS_ARRAY_LENGTH(JISCharToFreqOrder);
mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO;
}

View File

@ -20,9 +20,7 @@
#define EUCKR_TYPICAL_DISTRIBUTION_RATIO (float) 6.0
#define EUCKR_TABLE_SIZE 2352
//Char to FreqOrder table ,
// Char to FreqOrder table
static const int16_t EUCKRCharToFreqOrder[] =
{
13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87,

View File

@ -24,9 +24,7 @@
#define EUCTW_TYPICAL_DISTRIBUTION_RATIO (float)0.75
//Char to FreqOrder table ,
#define EUCTW_TABLE_SIZE 8102
// Char to FreqOrder table
static const int16_t EUCTWCharToFreqOrder[] =
{
1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, // 2742

View File

@ -21,8 +21,6 @@
#define GB2312_TYPICAL_DISTRIBUTION_RATIO (float)0.9
#define GB2312_TABLE_SIZE 3760
static const int16_t GB2312CharToFreqOrder[] =
{
1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205,

View File

@ -23,10 +23,7 @@
#define JIS_TYPICAL_DISTRIBUTION_RATIO (float) 3.0
//Char to FreqOrder table ,
#define JIS_TABLE_SIZE 4368
// Char to FreqOrder table
static const int16_t JISCharToFreqOrder[] =
{
40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, // 16