tesseract  4.0.0-1-g2a2b
set_unicharset_properties.cpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 // http://www.apache.org/licenses/LICENSE-2.0
5 // Unless required by applicable law or agreed to in writing, software
6 // distributed under the License is distributed on an "AS IS" BASIS,
7 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 // See the License for the specific language governing permissions and
9 // limitations under the License.
10 
11 // This program reads a unicharset file, puts the result in a UNICHARSET
12 // object, fills it with properties about the unichars it contains and writes
13 // the result back to a file.
14 
15 #include "commandlineflags.h"
16 #include "commontraining.h" // CheckSharedLibraryVersion
17 #include "tprintf.h"
19 
20 // The directory that is searched for universal script unicharsets.
21 STRING_PARAM_FLAG(script_dir, "",
22  "Directory name for input script unicharsets/xheights");
23 
24 // Flags from commontraining.cpp
28 
29 int main(int argc, char** argv) {
30  tesseract::CheckSharedLibraryVersion();
31  tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
32 
33  // Check validity of input flags.
34  if (FLAGS_U.empty() || FLAGS_O.empty()) {
35  tprintf("Specify both input and output unicharsets!\n");
36  exit(1);
37  }
38  if (FLAGS_script_dir.empty()) {
39  tprintf("Must specify a script_dir!\n");
40  exit(1);
41  }
42 
43  tesseract::SetPropertiesForInputFile(FLAGS_script_dir.c_str(),
44  FLAGS_U.c_str(), FLAGS_O.c_str(),
45  FLAGS_X.c_str());
46  return 0;
47 }
STRING_PARAM_FLAG(script_dir, "", "Directory name for input script unicharsets/xheights")
int main(int argc, char **argv)
void ParseCommandLineFlags(const char *usage, int *argc, char ***argv, const bool remove_flags)
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37
DECLARE_STRING_PARAM_FLAG(U)
void SetPropertiesForInputFile(const std::string &script_dir, const std::string &input_unicharset_file, const std::string &output_unicharset_file, const std::string &output_xheights_file)