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.
248 if (trainer ==
nullptr)
return 1;
255 SetupConfigMap(shape_table, &config_map);
267 unicharset = &shape_set;
271 for (
int s = 0; s < num_shapes; ++s) {
279 int num_configs = shape_table->
NumShapes();
281 for (
int s = 0; s < num_configs; ++s) {
282 int unichar_id, font_id;
283 if (unicharset == &shape_set) {
290 const char* class_label = unicharset->
id_to_unichar(unichar_id);
291 mf_classes = ClusterOneConfig(s, class_label, mf_classes, *shape_table,
294 STRING inttemp_file = file_prefix;
295 inttemp_file +=
"inttemp";
296 STRING pffmtable_file = file_prefix;
297 pffmtable_file +=
"pffmtable";
301 *shape_table, float_classes,
304 for (
int c = 0; c < unicharset->
size(); ++c) {
307 delete [] float_classes;
312 if (!FLAGS_test_ch.empty()) {
314 printf(
"Hit return to exit...\n");
315 while (getchar() !=
'\n');
void WriteShapeTable(const STRING &file_prefix, const ShapeTable &shape_table)
bool AnyMultipleUnichars() const
const UNICHARSET & unicharset() const
const char * string() const
const int kMaxShapeLabelLength
void ParseArguments(int *argc, char ***argv)
void GetFirstUnicharAndFont(int shape_id, int *unichar_id, int *font_id) const
const char * id_to_unichar(UNICHAR_ID 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)
void FreeClassFields(CLASS_TYPE Class)
MasterTrainer * LoadTrainingData(int argc, const char *const *argv, bool replication, ShapeTable **shape_table, STRING *file_prefix)
CLASS_STRUCT * SetUpForFloat2Int(const UNICHARSET &unicharset, LIST LabeledClassList)
virtual int SparseToCompact(int sparse_index) const
void FreeLabeledClassList(LIST ClassList)
void unichar_insert(const char *const unichar_repr)