20 #ifndef USE_STD_NAMESPACE
21 #include "base/commandlineflags.h"
45 const char*
names[] = {
"pruner",
"full",
"cube",
"cubetess",
NULL };
48 const char* classifer_name,
const UNICHARSET& unicharset,
49 int argc,
char **argv,
54 if (strcmp(classifer_name,
names[c]) == 0) {
59 if (classifier == CN_COUNT) {
60 fprintf(stderr,
"Invalid classifier name:%s\n", FLAGS_classifier.c_str());
73 (*api)->SetVariable(
"cube_debug_level",
"2");
74 if ((*api)->Init(FLAGS_tessdata_dir.c_str(), FLAGS_lang.c_str(),
76 fprintf(stderr,
"Tesseract initialization failed!\n");
82 fprintf(stderr,
"Tesseract must contain a ShapeTable!\n");
88 if (!FLAGS_T.empty()) {
89 const char* config_name;
91 tprintf(
"Reading config file %s ...\n", config_name);
92 (*api)->ReadConfigFile(config_name);
97 }
else if (classifier ==
CN_FULL) {
99 }
else if (classifier ==
CN_CUBE) {
104 fprintf(stderr,
"%s tester not yet implemented\n", classifer_name);
107 tprintf(
"Testing classifier %s:\n", classifer_name);
108 return shape_classifier;
132 int main(
int argc,
char **argv) {
136 argc, argv,
false,
NULL, &file_prefix);
140 FLAGS_classifier.c_str(), trainer->
unicharset(), argc, argv, &
api);
141 if (shape_classifier ==
NULL) {
142 fprintf(stderr,
"Classifier init failed!:%s\n", FLAGS_classifier.c_str());
152 MAX(3, FLAGS_debug_level),
false,
153 shape_classifier,
NULL);
154 delete shape_classifier;
const ShapeTable * shape_table() const
STRING_PARAM_FLAG(classifier,"","Classifier to test")
int main(int argc, char **argv)
struct TessBaseAPI TessBaseAPI
const char * GetNextFilename(int argc, const char *const *argv)
void ReplicateAndRandomizeSamplesIfRequired()
void ParseArguments(int *argc, char ***argv)
const UNICHARSET & unicharset() const
void TestClassifierOnSamples(CountTypes error_mode, int report_level, bool replicate_samples, ShapeClassifier *test_classifier, STRING *report_string)
MasterTrainer * LoadTrainingData(int argc, const char *const *argv, bool replication, ShapeTable **shape_table, STRING *file_prefix)
DECLARE_STRING_PARAM_FLAG(T)
DECLARE_INT_PARAM_FLAG(debug_level)