tesseract 4.1.1
Loading...
Searching...
No Matches
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.
21static STRING_PARAM_FLAG(script_dir, "",
22 "Directory name for input script unicharsets/xheights");
23
24int main(int argc, char** argv) {
25 tesseract::CheckSharedLibraryVersion();
26 tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
27
28 // Check validity of input flags.
29 if (FLAGS_U.empty() || FLAGS_O.empty()) {
30 tprintf("Specify both input and output unicharsets!\n");
31 exit(1);
32 }
33 if (FLAGS_script_dir.empty()) {
34 tprintf("Must specify a script_dir!\n");
35 exit(1);
36 }
37
38 tesseract::SetPropertiesForInputFile(FLAGS_script_dir.c_str(),
39 FLAGS_U.c_str(), FLAGS_O.c_str(),
40 FLAGS_X.c_str());
41 return 0;
42}
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:35
#define STRING_PARAM_FLAG(name, val, comment)
int main(int argc, char **argv)
void ParseCommandLineFlags(const char *usage, int *argc, char ***argv, const bool remove_flags)
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)