Back to index

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

#include <CharDistribution.h>

Inheritance diagram for CharDistributionAnalysis:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CharDistributionAnalysis ()
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

virtual PRInt32 GetOrder (const char *str)

Protected Attributes

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

Detailed Description

Definition at line 45 of file CharDistribution.h.


Constructor & Destructor Documentation

Definition at line 48 of file CharDistribution.h.

{Reset();};

Here is the call graph for this function:


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:

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

Reimplemented in EUCJPDistributionAnalysis, SJISDistributionAnalysis, Big5DistributionAnalysis, GB2312DistributionAnalysis, EUCKRDistributionAnalysis, and EUCTWDistributionAnalysis.

Definition at line 96 of file CharDistribution.h.

{return -1;};

Here is the caller graph for this function:

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]

Definition at line 51 of file CharDistribution.h.

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

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)
    {
      mTotalChars++;
      //order is valid
      if ((PRUint32)order < mTableSize)
      {
        if (512 > mCharToFreqOrder[order])
          mFreqChars++;
      }
    }
  };

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 77 of file CharDistribution.h.

  {
    mDone = PR_FALSE;
    mTotalChars = 0;
    mFreqChars = 0;
  };

Here is the caller graph for this function:

Definition at line 86 of file CharDistribution.h.

{};

Member Data Documentation

Definition at line 108 of file CharDistribution.h.

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: