7#include "ChineseGroupProber.h"
9#include "UnicodeGroupProber.h"
10#include "nsBig5Prober.h"
11#include "nsGB2312Prober.h"
16namespace kencodingprober
19static const char *
const ProberName[] = {
27ChineseGroupProber::ChineseGroupProber()
29 mProbers[0] =
new UnicodeGroupProber();
30 mProbers[1] =
new nsGB18030Prober();
31 mProbers[2] =
new nsBig5Prober();
35ChineseGroupProber::~ChineseGroupProber()
37 for (
unsigned int i = 0; i < CN_NUM_OF_PROBERS; i++) {
42const char *ChineseGroupProber::GetCharSetName()
44 if (mBestGuess == -1) {
46 if (mBestGuess == -1) {
50 return mProbers[mBestGuess]->GetCharSetName();
53void ChineseGroupProber::Reset(
void)
56 for (
unsigned int i = 0; i < CN_NUM_OF_PROBERS; i++) {
69nsProbingState ChineseGroupProber::HandleData(
const char *aBuf,
unsigned int aLen)
78 hptr = highbyteBuf = (
char *)malloc(aLen);
82 for (i = 0; i < aLen; ++i) {
95 for (i = 0; i < CN_NUM_OF_PROBERS; ++i) {
99 st = mProbers[i]->HandleData(highbyteBuf, hptr - highbyteBuf);
100 if (st == eFoundIt) {
104 }
else if (st == eNotMe) {
105 mIsActive[i] =
false;
107 if (mActiveNum == 0) {
119float ChineseGroupProber::GetConfidence(
void)
122 float bestConf = 0.0;
131 for (i = 0; i < CN_NUM_OF_PROBERS; ++i) {
135 cf = mProbers[i]->GetConfidence();
146void ChineseGroupProber::DumpStatus()
152 for (i = 0; i < CN_NUM_OF_PROBERS; i++) {
154 printf(
" Chinese group inactive: [%s] (confidence is too low).\r\n", ProberName[i]);
156 cf = mProbers[i]->GetConfidence();
157 printf(
" Chinese group %1.3f: [%s]\r\n", cf, ProberName[i]);
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:52 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.