97 if (ClassId >= NormProtos->NumProtos) {
114 Protos = NormProtos->Protos[ClassId];
117 tprintf(
"\nChar norm for class %s\n", unicharset.id_to_unichar(ClassId));
126 tprintf(
"YMiddle: Proto=%g, Delta=%g, Var=%g, Dist=%g\n",
133 tprintf(
"Height: Proto=%g, Delta=%g, Var=%g, Dist=%g\n",
140 tprintf(
"Width: Proto=%g, Delta=%g, Var=%g\n",
148 tprintf(
"Total Dist=%g, scaled=%g, sigmoid=%g, penalty=%g\n",
153 if (Match < BestMatch)
161 void Classify::FreeNormProtos() {
162 if (NormProtos !=
NULL) {
163 for (
int i = 0; i < NormProtos->NumProtos; i++)
165 Efree(NormProtos->Protos);
166 Efree(NormProtos->ParamDesc);
187 NormAdj = NormAdj * NormAdj * NormAdj;
189 NormAdj = NormAdj * NormAdj;
192 return (1.0 / (1.0 + NormAdj));
217 for (i = 0, TotalMatch = 0.0; i <
NumParams; i++) {
218 ParamMatch = (Feature->
Params[i] -
Mean(Proto, i)) /
221 fprintf (File,
" %6.1f", ParamMatch);
224 TotalMatch += ParamMatch * ParamMatch;
226 fprintf (File,
" --> %6.1f (%4.2f)\n",
255 NormProtos->
NumProtos = unicharset.size();
257 for (i = 0; i < NormProtos->
NumProtos; i++)
265 while ((end_offset < 0 || ftell(File) < end_offset) &&
266 tfscanf(File,
"%s %d", unichar, &NumProtos) == 2) {
267 if (unicharset.contains_unichar(unichar)) {
268 unichar_id = unicharset.unichar_to_id(unichar);
269 Protos = NormProtos->
Protos[unichar_id];
275 cprintf(
"Error: unichar %s in normproto file is not in unichar set.\n",
void FreePrototype(void *arg)
void PrintNormMatch(FILE *File, int NumParams, PROTOTYPE *Proto, FEATURE Feature)
PROTOTYPE * ReadPrototype(FILE *File, uinT16 N)
uinT16 ReadSampleSize(FILE *File)
#define double_VAR(name, val, comment)
double NormEvidenceOf(register double NormAdj)
NORM_PROTOS * ReadNormProtos(FILE *File)
const double kWidthErrorWeighting
FLOAT32 StandardDeviation(PROTOTYPE *Proto, uinT16 Dimension)
double classify_norm_adj_curl
FLOAT32 Mean(PROTOTYPE *Proto, uinT16 Dimension)
PARAM_DESC * ReadParamDesc(FILE *File, uinT16 N)
void cprintf(const char *format,...)
int tfscanf(FILE *stream, const char *format,...)
void SkipNewline(FILE *file)
void FreeProtoList(LIST *ProtoList)
double classify_norm_adj_midpoint
LIST push_last(LIST list, void *item)