Skip to content

Commit

Permalink
normmatch: Remove unused private function
Browse files Browse the repository at this point in the history
PrintNormMatch was unused. Remove it and remove also an unused prototype.
Make the only remaining private function NormEvidenceOf static.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed May 14, 2019
1 parent b9b74a6 commit caa0488
Showing 1 changed file with 19 additions and 64 deletions.
83 changes: 19 additions & 64 deletions src/classify/normmatch.cpp
Expand Up @@ -2,7 +2,6 @@
** Filename: normmatch.c
** Purpose: Simple matcher based on character normalization features.
** Author: Dan Johnson
** History: Wed Dec 19 16:18:06 1990, DSJ, Created.
**
** (c) Copyright Hewlett-Packard Company, 1988.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -40,16 +39,28 @@ struct NORM_PROTOS
};

/*----------------------------------------------------------------------------
Private Function Prototypes
Private Code
----------------------------------------------------------------------------*/
double NormEvidenceOf(double NormAdj);

void PrintNormMatch(FILE *File,
int NumParams,
PROTOTYPE *Proto,
FEATURE Feature);
/**
* @name NormEvidenceOf
*
* Return the new type of evidence number corresponding to this
* normalization adjustment. The equation that represents the transform is:
* 1 / (1 + (NormAdj / midpoint) ^ curl)
*/
static double NormEvidenceOf(double NormAdj) {
NormAdj /= classify_norm_adj_midpoint;

NORM_PROTOS *ReadNormProtos(FILE *File);
if (classify_norm_adj_curl == 3) {
NormAdj = NormAdj * NormAdj * NormAdj;
} else if (classify_norm_adj_curl == 2) {
NormAdj = NormAdj * NormAdj;
} else {
NormAdj = pow(NormAdj, classify_norm_adj_curl);
}
return (1.0 / (1.0 + NormAdj));
}

/*----------------------------------------------------------------------------
Variables
Expand Down Expand Up @@ -165,62 +176,6 @@ void Classify::FreeNormProtos() {
}
} // namespace tesseract

/*----------------------------------------------------------------------------
Private Code
----------------------------------------------------------------------------*/
/**
* @name NormEvidenceOf
*
* Return the new type of evidence number corresponding to this
* normalization adjustment. The equation that represents the transform is:
* 1 / (1 + (NormAdj / midpoint) ^ curl)
*/
double NormEvidenceOf(double NormAdj) {
NormAdj /= classify_norm_adj_midpoint;

if (classify_norm_adj_curl == 3)
NormAdj = NormAdj * NormAdj * NormAdj;
else if (classify_norm_adj_curl == 2)
NormAdj = NormAdj * NormAdj;
else
NormAdj = pow (NormAdj, classify_norm_adj_curl);
return (1.0 / (1.0 + NormAdj));
}


/*---------------------------------------------------------------------------*/
/**
* This routine dumps out detailed normalization match info.
* @param File open text file to dump match debug info to
* @param NumParams # of parameters in proto and feature
* @param Proto[] array of prototype parameters
* @param Feature[] array of feature parameters
* Globals: none
* @return none
*/
void PrintNormMatch(FILE *File,
int NumParams,
PROTOTYPE *Proto,
FEATURE Feature) {
int i;
float ParamMatch;
float TotalMatch;

for (i = 0, TotalMatch = 0.0; i < NumParams; i++) {
ParamMatch = (Feature->Params[i] - Mean(Proto, i)) /
StandardDeviation(Proto, i);

fprintf (File, " %6.1f", ParamMatch);

if (i == CharNormY || i == CharNormRx)
TotalMatch += ParamMatch * ParamMatch;
}
fprintf (File, " --> %6.1f (%4.2f)\n",
TotalMatch, NormEvidenceOf (TotalMatch));

} /* PrintNormMatch */


/*---------------------------------------------------------------------------*/
namespace tesseract {
/**
Expand Down

0 comments on commit caa0488

Please sign in to comment.