21 #ifdef GOOGLE_TESSERACT
22 #include "base/commandlineflags.h"
23 #endif // GOOGLE_TESSERACT
42 static const char* names[] = {
"pruner",
"full"};
45 const char* classifer_name,
const UNICHARSET& unicharset,
46 int argc,
char **argv,
51 if (strcmp(classifer_name, names[c]) == 0) {
52 classifier = static_cast<ClassifierName>(c);
57 fprintf(stderr,
"Invalid classifier name:%s\n", FLAGS_classifier.c_str());
68 if ((*api)->Init(FLAGS_tessdata_dir.c_str(), FLAGS_lang.c_str(),
70 fprintf(stderr,
"Tesseract initialization failed!\n");
73 tesseract = const_cast<tesseract::Tesseract*>((*api)->tesseract());
74 classify = static_cast<tesseract::Classify*>(
tesseract);
75 if (classify->shape_table() ==
nullptr) {
76 fprintf(stderr,
"Tesseract must contain a ShapeTable!\n");
84 }
else if (classifier ==
CN_FULL) {
87 tprintf(
"Testing classifier %s:\n", classifer_name);
88 return shape_classifier;
110 int main(
int argc,
char **argv) {
111 tesseract::CheckSharedLibraryVersion();
119 FLAGS_classifier.c_str(), trainer->
unicharset(), argc, argv, &api);
120 if (shape_classifier ==
nullptr) {
121 fprintf(stderr,
"Classifier init failed!:%s\n", FLAGS_classifier.c_str());
131 std::max(3, static_cast<int>(FLAGS_debug_level)),
false,
132 shape_classifier,
nullptr);
133 delete shape_classifier;