Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
EUCKRDistributionAnalysis Class Reference

#include <CharDistribution.h>

Inheritance diagram for EUCKRDistributionAnalysis:
Inheritance graph
Collaboration diagram for EUCKRDistributionAnalysis:
Collaboration graph

List of all members.

Public Member Functions

 EUCKRDistributionAnalysis ()
void HandleData (const char *aBuf, PRUint32 aLen)
void HandleOneChar (const char *aStr, PRUint32 aCharLen)
float GetConfidence ()
void Reset (void)
void SetOpion ()
PRBool GotEnoughData ()

Protected Member Functions

PRInt32 GetOrder (const char *str)

Protected Attributes

PRBool mDone
PRUint32 mFreqChars
PRUint32 mTotalChars
const PRInt16mCharToFreqOrder
PRUint32 mTableSize
float mTypicalDistributionRatio

Detailed Description

Definition at line 138 of file CharDistribution.h.

Constructor & Destructor Documentation

Definition at line 77 of file CharDistribution.cpp.

  mCharToFreqOrder = EUCKRCharToFreqOrder;
  mTableSize = EUCKR_TABLE_SIZE;

Member Function Documentation

Definition at line 52 of file CharDistribution.cpp.

  //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) {
    float r = mFreqChars / ((mTotalChars - mFreqChars) * mTypicalDistributionRatio);

    if (r < SURE_YES)
      return r;
  //normalize confidence, (we don't want to be 100% sure)
  return SURE_YES;

Here is the caller graph for this function:

PRInt32 EUCKRDistributionAnalysis::GetOrder ( const char *  str) [inline, protected, virtual]

Reimplemented from CharDistributionAnalysis.

Definition at line 147 of file CharDistribution.h.

  { if ((unsigned char)*str >= (unsigned char)0xb0)  
      return 94*((unsigned char)str[0]-(unsigned char)0xb0) + (unsigned char)str[1] - (unsigned char)0xa1;
      return -1;

Definition at line 90 of file CharDistribution.h.

Here is the caller graph for this function:

void CharDistributionAnalysis::HandleData ( const char *  aBuf,
PRUint32  aLen 
) [inline, inherited]

Definition at line 51 of file CharDistribution.h.

void CharDistributionAnalysis::HandleOneChar ( const char *  aStr,
PRUint32  aCharLen 
) [inline, inherited]

Definition at line 54 of file CharDistribution.h.

    PRInt32 order;

    //we only care about 2-bytes character in our distribution analysis
    order = (aCharLen == 2) ? GetOrder(aStr) : -1;

    if (order >= 0)
      //order is valid
      if ((PRUint32)order < mTableSize)
        if (512 > mCharToFreqOrder[order])

Here is the call graph for this function:

Here is the caller graph for this function:

void CharDistributionAnalysis::Reset ( void  ) [inline, inherited]

Definition at line 77 of file CharDistribution.h.

    mDone = PR_FALSE;
    mTotalChars = 0;
    mFreqChars = 0;

Here is the caller graph for this function:

void CharDistributionAnalysis::SetOpion ( ) [inline, inherited]

Definition at line 86 of file CharDistribution.h.


Member Data Documentation

Definition at line 108 of file CharDistribution.h.

PRBool CharDistributionAnalysis::mDone [protected, inherited]

Definition at line 96 of file CharDistribution.h.

Definition at line 102 of file CharDistribution.h.

Definition at line 111 of file CharDistribution.h.

Definition at line 105 of file CharDistribution.h.

Definition at line 115 of file CharDistribution.h.

The documentation for this class was generated from the following files: