20 #ifndef USE_STD_NAMESPACE 21 #include "base/commandlineflags.h" 22 #endif // USE_STD_NAMESPACE 27 #endif // NO_CUBE_BUILD 45 #endif // NO_CUBE_BUILD 49 const char*
names[] = {
"pruner",
"full",
52 #endif // NO_CUBE_BUILD 56 const char* classifer_name,
const UNICHARSET& unicharset,
57 int argc,
char **argv,
62 if (strcmp(classifer_name,
names[c]) == 0) {
68 fprintf(stderr,
"Invalid classifier name:%s\n", FLAGS_classifier.c_str());
78 #endif // NO_CUBE_BUILD 87 (*api)->SetVariable(
"cube_debug_level",
"2");
88 #endif // NO_CUBE_BUILD 89 if ((*api)->Init(FLAGS_tessdata_dir.c_str(), FLAGS_lang.c_str(),
91 fprintf(stderr,
"Tesseract initialization failed!\n");
97 fprintf(stderr,
"Tesseract must contain a ShapeTable!\n");
103 if (!FLAGS_T.empty()) {
104 const char* config_name;
106 tprintf(
"Reading config file %s ...\n", config_name);
107 (*api)->ReadConfigFile(config_name);
112 }
else if (classifier ==
CN_FULL) {
114 #ifndef NO_CUBE_BUILD 115 }
else if (classifier ==
CN_CUBE) {
119 #endif // NO_CUBE_BUILD 121 fprintf(stderr,
"%s tester not yet implemented\n", classifer_name);
124 tprintf(
"Testing classifier %s:\n", classifer_name);
125 return shape_classifier;
149 int main(
int argc,
char **argv) {
153 argc, argv,
false, NULL, &file_prefix);
157 FLAGS_classifier.c_str(), trainer->
unicharset(), argc, argv, &
api);
158 if (shape_classifier == NULL) {
159 fprintf(stderr,
"Classifier init failed!:%s\n", FLAGS_classifier.c_str());
169 MAX(3, FLAGS_debug_level),
false,
170 shape_classifier, NULL);
171 delete shape_classifier;
struct TessBaseAPI TessBaseAPI
void ParseArguments(int *argc, char ***argv)
DECLARE_STRING_PARAM_FLAG(T)
void TestClassifierOnSamples(CountTypes error_mode, int report_level, bool replicate_samples, ShapeClassifier *test_classifier, STRING *report_string)
void ReplicateAndRandomizeSamplesIfRequired()
MasterTrainer * LoadTrainingData(int argc, const char *const *argv, bool replication, ShapeTable **shape_table, STRING *file_prefix)
const ShapeTable * shape_table() const
const char * GetNextFilename(int argc, const char *const *argv)
STRING_PARAM_FLAG(classifier, "", "Classifier to test")
int main(int argc, char **argv)
DECLARE_INT_PARAM_FLAG(debug_level)
const UNICHARSET & unicharset() const