This program reads in a text file consisting of feature samples from a training page in the following format:
The result of this program is a binary inttemp file used by the OCR engine.
209 {
210 tesseract::CheckSharedLibraryVersion();
211
213
216
218 false,
219 &shape_table,
220 &file_prefix);
221 if (trainer == nullptr) return 1;
222
223
224
225
226
228 SetupConfigMap(shape_table, &config_map);
229
231
232
233
234
237
238
240 unicharset = &shape_set;
241
242
244 for (int s = 0; s < num_shapes; ++s) {
248 }
249 }
250
251
252 int num_configs = shape_table->
NumShapes();
254 for (int s = 0; s < num_configs; ++s) {
255 int unichar_id, font_id;
256 if (unicharset == &shape_set) {
257
259 } else {
260
262 }
263 const char* class_label = unicharset->
id_to_unichar(unichar_id);
264 mf_classes = ClusterOneConfig(s, class_label, mf_classes, *shape_table,
265 trainer);
266 }
267 STRING inttemp_file = file_prefix;
268 inttemp_file += "inttemp";
269 STRING pffmtable_file = file_prefix;
270 pffmtable_file += "pffmtable";
272
274 *shape_table, float_classes,
277 for (
int c = 0; c < unicharset->
size(); ++c) {
279 }
280 delete [] float_classes;
282 delete trainer;
283 delete shape_table;
284 printf("Done!\n");
285 if (!FLAGS_test_ch.empty()) {
286
287 printf("Hit return to exit...\n");
288 while (getchar() != '\n');
289 }
290 return 0;
291}
void FreeClassFields(CLASS_TYPE Class)
void FreeLabeledClassList(LIST ClassList)
CLASS_STRUCT * SetUpForFloat2Int(const UNICHARSET &unicharset, LIST LabeledClassList)
void ParseArguments(int *argc, char ***argv)
const int kMaxShapeLabelLength
MasterTrainer * LoadTrainingData(int argc, const char *const *argv, bool replication, ShapeTable **shape_table, STRING *file_prefix)
void WriteShapeTable(const STRING &file_prefix, const ShapeTable &shape_table)
int SparseToCompact(int sparse_index) const override
const char * string() const
void unichar_insert(const char *const unichar_repr, OldUncleanUnichars old_style)
const char * id_to_unichar(UNICHAR_ID id) const
bool AnyMultipleUnichars() const
void GetFirstUnicharAndFont(int shape_id, int *unichar_id, int *font_id) const
void WriteInttempAndPFFMTable(const UNICHARSET &unicharset, const UNICHARSET &shape_set, const ShapeTable &shape_table, CLASS_STRUCT *float_classes, const char *inttemp_file, const char *pffmtable_file)
const UNICHARSET & unicharset() const