tesseract 3.04.01

training/set_unicharset_properties.cpp

Go to the documentation of this file.
00001 // This program reads a unicharset file, puts the result in a UNICHARSET
00002 // object, fills it with properties about the unichars it contains and writes
00003 // the result back to a file.
00004 
00005 #include <stdlib.h>
00006 #include <string.h>
00007 #include <string>
00008 
00009 #include "commandlineflags.h"
00010 #include "tprintf.h"
00011 #include "unicharset_training_utils.h"
00012 
00013 // The directory that is searched for universal script unicharsets.
00014 STRING_PARAM_FLAG(script_dir, "",
00015                   "Directory name for input script unicharsets/xheights");
00016 
00017 // Flags from commontraining.cpp
00018 DECLARE_STRING_PARAM_FLAG(U);
00019 DECLARE_STRING_PARAM_FLAG(O);
00020 DECLARE_STRING_PARAM_FLAG(X);
00021 
00022 int main(int argc, char** argv) {
00023   tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
00024 
00025   // Check validity of input flags.
00026   if (FLAGS_U.empty() || FLAGS_O.empty()) {
00027     tprintf("Specify both input and output unicharsets!\n");
00028     exit(1);
00029   }
00030   if (FLAGS_script_dir.empty()) {
00031     tprintf("Must specify a script_dir!\n");
00032     exit(1);
00033   }
00034 
00035   tesseract::SetPropertiesForInputFile(FLAGS_script_dir.c_str(),
00036                                        FLAGS_U.c_str(), FLAGS_O.c_str(),
00037                                        FLAGS_X.c_str());
00038   return 0;
00039 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines