Go to the source code of this file.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
This program reads in a text file consisting of feature samples from a training page in the following format:
FontName UTF8-char-str xmin ymin xmax ymax page-number
NumberOfFeatureTypes(N)
FeatureTypeName1 NumberOfFeatures(M)
Feature1
...
FeatureM
FeatureTypeName2 NumberOfFeatures(M)
Feature1
...
FeatureM
...
FeatureTypeNameN NumberOfFeatures(M)
Feature1
...
FeatureM
FontName CharName ...
The result of this program is a binary inttemp file used by the OCR engine.
- Parameters
-
argc | number of command line arguments |
argv | array of command line arguments |
- Returns
- none
- Note
- Exceptions: none
-
History: Fri Aug 18 08:56:17 1989, DSJ, Created.
-
History: Mon May 18 1998, Christy Russson, Revistion started.
Definition at line 66 of file combine_tessdata.cpp.
70 printf(
"Combining tessdata files\n");
72 char*
last = &argv[1][strlen(argv[1])-1];
76 output_file += kTrainedDataSuffix;
78 printf(
"Error combining tessdata files into %s\n",
81 printf(
"Output %s created successfully.\n", output_file.
string());
83 }
else if (argc >= 4 && (strcmp(argv[1],
"-e") == 0 ||
84 strcmp(argv[1],
"-u") == 0)) {
87 printf(
"Extracting tessdata components from %s\n", argv[2]);
88 if (strcmp(argv[1],
"-e") == 0) {
89 for (i = 3; i < argc; ++i) {
91 printf(
"Wrote %s\n", argv[i]);
93 printf(
"Not extracting %s, since this component" 94 " is not present\n", argv[i]);
100 char* last = &argv[3][strlen(argv[3])-1];
103 filename += tesseract::kTessdataFileSuffixes[i];
105 printf(
"Wrote %s\n", filename.
string());
109 }
else if (argc >= 4 && strcmp(argv[1],
"-o") == 0) {
111 const char *new_traineddata_filename = argv[2];
112 STRING traineddata_filename = new_traineddata_filename;
113 traineddata_filename +=
".__tmp__";
114 if (rename(new_traineddata_filename, traineddata_filename.
string()) != 0) {
115 tprintf(
"Failed to create a temporary file %s\n",
116 traineddata_filename.
string());
126 printf(
"Usage for combining tessdata components:\n" 127 " %s language_data_path_prefix\n" 128 " (e.g. %s tessdata/eng.)\n\n", argv[0], argv[0]);
129 printf(
"Usage for extracting tessdata components:\n" 130 " %s -e traineddata_file [output_component_file...]\n" 131 " (e.g. %s -e eng.traineddata eng.unicharset)\n\n",
133 printf(
"Usage for overwriting tessdata components:\n" 134 " %s -o traineddata_file [input_component_file...]\n" 135 " (e.g. %s -o eng.traineddata eng.unicharset)\n\n",
137 printf(
"Usage for unpacking all tessdata components:\n" 138 " %s -u traineddata_file output_path_prefix\n" 139 " (e.g. %s -u eng.traineddata tmp/eng.)\n", argv[0], argv[0]);
bool OverwriteComponents(const char *new_traineddata_filename, char **component_filenames, int num_new_components)
const char * string() const
bool ExtractToFile(const char *filename)
bool CombineDataFiles(const char *language_data_path_prefix, const char *output_filename)
bool Init(const char *data_file_name)