tesseract v5.3.3.20231005
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
20using namespace tesseract;
21
22// The directory that is searched for universal script unicharsets.
23static STRING_PARAM_FLAG(script_dir, "", "Directory name for input script unicharsets/xheights");
24
25int main(int argc, char **argv) {
26 tesseract::CheckSharedLibraryVersion();
27 tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
28
29 // Check validity of input flags.
30 if (FLAGS_U.empty() || FLAGS_O.empty()) {
31 tprintf("Specify both input and output unicharsets!\n");
32 return EXIT_FAILURE;
33 }
34 if (FLAGS_script_dir.empty()) {
35 tprintf("Must specify a script_dir!\n");
36 return EXIT_FAILURE;
37 }
38
39 tesseract::SetPropertiesForInputFile(FLAGS_script_dir.c_str(), FLAGS_U.c_str(), FLAGS_O.c_str(),
40 FLAGS_X.c_str());
41 return EXIT_SUCCESS;
42}
#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 tprintf(const char *format,...)
Definition: tprintf.cpp:41
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)