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.
210 tesseract::CheckSharedLibraryVersion();
221 if (trainer ==
nullptr)
return 1;
228 SetupConfigMap(shape_table, &config_map);
240 unicharset = &shape_set;
244 for (
int s = 0; s < num_shapes; ++s) {
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) {
263 const char* class_label = unicharset->
id_to_unichar(unichar_id);
264 mf_classes = ClusterOneConfig(s, class_label, mf_classes, *shape_table,
267 STRING inttemp_file = file_prefix;
268 inttemp_file +=
"inttemp";
269 STRING pffmtable_file = file_prefix;
270 pffmtable_file +=
"pffmtable";
274 *shape_table, float_classes,
277 for (
int c = 0; c < unicharset->
size(); ++c) {
280 delete [] float_classes;
285 if (!FLAGS_test_ch.empty()) {
287 printf(
"Hit return to exit...\n");
288 while (getchar() !=
'\n');
const UNICHARSET & unicharset() const
const int kMaxShapeLabelLength
CLASS_STRUCT * SetUpForFloat2Int(const UNICHARSET &unicharset, LIST LabeledClassList)
void FreeLabeledClassList(LIST ClassList)
void unichar_insert(const char *const unichar_repr, OldUncleanUnichars old_style)
int SparseToCompact(int sparse_index) const override
const char * string() const
void GetFirstUnicharAndFont(int shape_id, int *unichar_id, int *font_id) const
void WriteShapeTable(const STRING &file_prefix, const ShapeTable &shape_table)
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)
void FreeClassFields(CLASS_TYPE Class)
void ParseArguments(int *argc, char ***argv)
const char * id_to_unichar(UNICHAR_ID id) const
MasterTrainer * LoadTrainingData(int argc, const char *const *argv, bool replication, ShapeTable **shape_table, STRING *file_prefix)
bool AnyMultipleUnichars() const