28 "Filename with unicharset to complete and use in encoding");
29static STRING_PARAM_FLAG(script_dir,
"",
"Directory name for input script unicharsets");
30static STRING_PARAM_FLAG(words,
"",
"File listing words to use for the system dictionary");
34static STRING_PARAM_FLAG(version_str,
"",
"Version string to add to traineddata file");
36static BOOL_PARAM_FLAG(lang_is_rtl,
false,
"True if lang being processed is written right-to-left");
38 "If true, the recoder is a simple pass-through of the "
39 "unicharset. Otherwise, potentially a compression of it");
41int main(
int argc,
char **argv) {
50 tesseract::CheckSharedLibraryVersion();
59 if (!unicharset.
load_from_file(FLAGS_input_unicharset.c_str(),
false)) {
60 tprintf(
"Failed to load unicharset from %s\n", FLAGS_input_unicharset.c_str());
63 tprintf(
"Loaded unicharset of size %zu from file %s\n", unicharset.
size(),
64 FLAGS_input_unicharset.c_str());
67 tprintf(
"Setting unichar properties\n");
70 tprintf(
"Setting script properties\n");
74 FLAGS_version_str.c_str(), FLAGS_output_dir.c_str(),
75 FLAGS_lang.c_str(), FLAGS_pass_through_recoder, words, puncs,
76 numbers, FLAGS_lang_is_rtl,
nullptr,
#define BOOL_PARAM_FLAG(name, val, comment)
#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,...)
void SetupBasicProperties(bool report_errors, bool decompose, UNICHARSET *unicharset)
void SetScriptProperties(const std::string &script_dir, UNICHARSET *unicharset)
std::string ReadFile(const std::string &filename, FileReader reader)
int CombineLangModel(const UNICHARSET &unicharset, const std::string &script_dir, const std::string &version_str, const std::string &output_dir, const std::string &lang, bool pass_through_recoder, const std::vector< std::string > &words, const std::vector< std::string > &puncs, const std::vector< std::string > &numbers, bool lang_is_rtl, FileReader reader, FileWriter writer)
const std::vector< std::string > split(const std::string &s, char c)
bool load_from_file(const char *const filename, bool skip_fragments)