tesseract  4.00.00dev
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 <stdlib.h>
16 #include <string.h>
17 #include <string>
18 
19 #include "commandlineflags.h"
20 #include "tprintf.h"
22 
23 // The directory that is searched for universal script unicharsets.
24 STRING_PARAM_FLAG(script_dir, "",
25  "Directory name for input script unicharsets/xheights");
26 
27 // Flags from commontraining.cpp
31 
32 int main(int argc, char** argv) {
33  tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
34 
35  // Check validity of input flags.
36  if (FLAGS_U.empty() || FLAGS_O.empty()) {
37  tprintf("Specify both input and output unicharsets!\n");
38  exit(1);
39  }
40  if (FLAGS_script_dir.empty()) {
41  tprintf("Must specify a script_dir!\n");
42  exit(1);
43  }
44 
45  tesseract::SetPropertiesForInputFile(FLAGS_script_dir.c_str(),
46  FLAGS_U.c_str(), FLAGS_O.c_str(),
47  FLAGS_X.c_str());
48  return 0;
49 }
DECLARE_STRING_PARAM_FLAG(U)
int main(int argc, char **argv)
#define tprintf(...)
Definition: tprintf.h:31
void SetPropertiesForInputFile(const string &script_dir, const string &input_unicharset_file, const string &output_unicharset_file, const string &output_xheights_file)
STRING_PARAM_FLAG(script_dir, "", "Directory name for input script unicharsets/xheights")
void ParseCommandLineFlags(const char *usage, int *argc, char ***argv, const bool remove_flags)